From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()
Date: Wed, 03 Sep 2014 05:50:26 +0200 [thread overview]
Message-ID: <54069002.5010404@web.de> (raw)
In-Reply-To: <xmqqoauxzv1f.fsf@gitster.dls.corp.google.com>
Am 02.09.2014 um 21:23 schrieb Junio C Hamano:
> René Scharfe <l.s.r@web.de> writes:
>
>> 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>
>> ---
>> imap-send.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/imap-send.c b/imap-send.c
>> index 524fbab..b079a0d 100644
>> --- a/imap-send.c
>> +++ b/imap-send.c
>> @@ -802,7 +802,10 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
>> resp = DRV_OK;
>> else {
>> if (!strcmp("NO", arg)) {
>> - if (cmdp->cb.create && cmd && (cmdp->cb.trycreate || !memcmp(cmd, "[TRYCREATE]", 11))) { /* SELECT, APPEND or UID COPY */
>> + if (cmdp->cb.create && cmd &&
>> + (cmdp->cb.trycreate ||
>> + starts_with(cmd, "[TRYCREATE]"))) {
>> + /* SELECT, APPEND or UID COPY */
>> p = strchr(cmdp->cmd, '"');
>> if (!issue_imap_cmd(ctx, NULL, "CREATE \"%.*s\"", (int)(strchr(p + 1, '"') - p + 1), p)) {
>> resp = RESP_BAD;
>
> Do we want this hunk, given that it will disappear with the
> tf/imap-send-create topic at e0d8e308 (imap-send: create target
> mailbox if it is missing, 2014-08-01)?
In that case it's unnecessary; apparently I overlooked the conflicting
hunk while preparing the patch for sending.
René
prev parent reply other threads:[~2014-09-03 3:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-30 16:14 [PATCH] imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with() René Scharfe
2014-09-02 19:23 ` Junio C Hamano
2014-09-03 3:50 ` René Scharfe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54069002.5010404@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.