git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Quint Guvernator <quintus.public@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] general style: replaces memcmp() with starts_with()
Date: Wed, 12 Mar 2014 20:51:37 +0700	[thread overview]
Message-ID: <CACsJy8DUhqn_ESzT-KpAdrWvWcLbPUiXDmBZXu7UtHU+M0GLgw@mail.gmail.com> (raw)
In-Reply-To: <1394631854-11208-1-git-send-email-quintus.public@gmail.com>

On Wed, Mar 12, 2014 at 8:44 PM, Quint Guvernator
<quintus.public@gmail.com> wrote:
> diff --git a/builtin/apply.c b/builtin/apply.c
> index a7e72d5..8f21957 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -846,8 +846,8 @@ static int has_epoch_timestamp(const char *nameline)
>          * YYYY-MM-DD hh:mm:ss must be from either 1969-12-31
>          * (west of GMT) or 1970-01-01 (east of GMT)
>          */
> -       if ((zoneoffset < 0 && memcmp(timestamp, "1969-12-31", 10)) ||
> -           (0 <= zoneoffset && memcmp(timestamp, "1970-01-01", 10)))
> +       if ((zoneoffset < 0 && starts_with(timestamp, "1969-12-31")) ||
> +           (0 <= zoneoffset && starts_with(timestamp, "1970-01-01")))
>                 return 0;

It is not a plain search/replace. starts_with(..) == !memcmp(...). So
you need to negate every replacement.
-- 
Duy

  reply	other threads:[~2014-03-12 13:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 13:44 [PATCH] general style: replaces memcmp() with starts_with() Quint Guvernator
2014-03-12 13:51 ` Duy Nguyen [this message]
2014-03-12 14:06   ` Quint Guvernator
2014-03-13 16:05     ` Michael Haggerty
2014-03-14 16:32       ` Quint Guvernator
2014-03-12 15:47 ` Jens Lehmann
2014-03-12 16:46   ` Quint Guvernator
2014-03-12 17:22     ` Jens Lehmann
2014-03-12 18:00       ` Jeff King
2014-03-12 23:26       ` Duy Nguyen

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACsJy8DUhqn_ESzT-KpAdrWvWcLbPUiXDmBZXu7UtHU+M0GLgw@mail.gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=quintus.public@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).