From: Christian Couder Date: Sat, 09 Nov 2013 07:06:14 GMT Subject: [PATCH 21/86] imap-send: replace prefixcmd() with has_prefix() Message-ID: <20131109070720.18178.19524.chriscool@tuxfamily.org> In-Reply-To: <20131109070358.18178.40248.chriscool@tuxfamily.org> Signed-off-by: Christian Couder --- imap-send.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/imap-send.c b/imap-send.c index 6f5cc4f..670de9f 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1263,7 +1263,7 @@ static int count_messages(struct strbuf *all_msgs) char *p = all_msgs->buf; while (1) { - if (!prefixcmp(p, "From ")) { + if (has_prefix(p, "From ")) { p = strstr(p+5, "\nFrom: "); if (!p) break; p = strstr(p+7, "\nDate: "); @@ -1297,7 +1297,7 @@ static int split_msg(struct strbuf *all_msgs, struct strbuf *msg, int *ofs) data = &all_msgs->buf[*ofs]; len = all_msgs->len - *ofs; - if (len < 5 || prefixcmp(data, "From ")) + if (len < 5 || !has_prefix(data, "From ")) return 0; p = strchr(data, '\n'); @@ -1339,13 +1339,13 @@ static int git_imap_config(const char *key, const char *val, void *cb) if (!strcmp("folder", key)) { imap_folder = xstrdup(val); } else if (!strcmp("host", key)) { - if (!prefixcmp(val, "imap:")) + if (has_prefix(val, "imap:")) val += 5; - else if (!prefixcmp(val, "imaps:")) { + else if (has_prefix(val, "imaps:")) { val += 6; server.use_ssl = 1; } - if (!prefixcmp(val, "//")) + if (has_prefix(val, "//")) val += 2; server.host = xstrdup(val); } else if (!strcmp("user", key)) -- 1.8.4.1.566.geca833c