summaryrefslogtreecommitdiff
path: root/imap-send.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-08-30 18:14:24 +0200
committerJunio C Hamano <gitster@pobox.com>2014-09-02 12:26:23 -0700
commitba9b9e124276e5d27ecf0e7701df1dedab6375c8 (patch)
treefb05b9c3724329c1c08468f96db4b959be27176e /imap-send.c
parent3918057164a8060082b828c0ac1ce25ad6a86d38 (diff)
downloadgit-ba9b9e124276e5d27ecf0e7701df1dedab6375c8.tar.gz
imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()br/imap-send-simplify-tunnel-child-process
Use starts_with() instead of memcmp() to check if NUL-terminated strings match prefixes. This gets rid of some magic string length constants. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'imap-send.c')
-rw-r--r--imap-send.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/imap-send.c b/imap-send.c
index 05a02b51ca..44fd5249e2 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -526,7 +526,7 @@ static struct imap_cmd *v_issue_imap_cmd(struct imap_store *ctx,
if (Verbose) {
if (imap->num_in_progress)
printf("(%d in progress) ", imap->num_in_progress);
- if (memcmp(cmd->cmd, "LOGIN", 5))
+ if (!starts_with(cmd->cmd, "LOGIN"))
printf(">>> %s", buf);
else
printf(">>> %d LOGIN <user> <pass>\n", cmd->tag);
@@ -829,7 +829,7 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
} else /*if (!strcmp("BAD", arg))*/
resp = RESP_BAD;
fprintf(stderr, "IMAP command '%s' returned response (%s) - %s\n",
- memcmp(cmdp->cmd, "LOGIN", 5) ?
+ !starts_with(cmdp->cmd, "LOGIN") ?
cmdp->cmd : "LOGIN <user> <pass>",
arg, cmd ? cmd : "");
}