avoid using skip_prefix as a boolean
authorJeff King <peff@peff.net>
Wed, 18 Jun 2014 19:42:14 +0000 (15:42 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Jun 2014 21:56:54 +0000 (14:56 -0700)
There's no point in using:

if (skip_prefix(buf, "foo"))

over

if (starts_with(buf, "foo"))

as the point of skip_prefix is to return a pointer to the
data after the prefix. Using starts_with is more readable,
and will make refactoring skip_prefix easier.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fmt-merge-msg.c
index 3906eda87712ea099e0e5876fff1fe28fc5716be..72378e6810a33b8d0e0285b14babc57b39287bb9 100644 (file)
@@ -298,7 +298,7 @@ static void credit_people(struct strbuf *out,
            (them->nr == 1 &&
             me &&
             (me = skip_prefix(me, them->items->string)) != NULL &&
-            skip_prefix(me, " <")))
+            starts_with(me, " <")))
                return;
        strbuf_addf(out, "\n%c %s ", comment_line_char, label);
        add_people_count(out, them);