diff options
author | Christian Couder <chriscool@tuxfamily.org> | 2013-11-30 21:55:40 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-05 14:13:21 -0800 |
commit | 59556548230e617b837343c2c07e357e688e2ca4 (patch) | |
tree | 5e66894c3d666f0fdc39aaf79de554dfeb7d0e36 /http-push.c | |
parent | 956623157f828b2b4fd91a9bc5e78ba8e42437d9 (diff) | |
download | git-59556548230e617b837343c2c07e357e688e2ca4.tar.gz |
replace {pre,suf}fixcmp() with {starts,ends}_with()cc/starts-n-ends-with
Leaving only the function definitions and declarations so that any
new topic in flight can still make use of the old functions, replace
existing uses of the prefixcmp() and suffixcmp() with new API
functions.
The change can be recreated by mechanically applying this:
$ git grep -l -e prefixcmp -e suffixcmp -- \*.c |
grep -v strbuf\\.c |
xargs perl -pi -e '
s|!prefixcmp\(|starts_with\(|g;
s|prefixcmp\(|!starts_with\(|g;
s|!suffixcmp\(|ends_with\(|g;
s|suffixcmp\(|!ends_with\(|g;
'
on the result of preparatory changes in this series.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r-- | http-push.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/http-push.c b/http-push.c index 34cb70f90e..d4b40c9c60 100644 --- a/http-push.c +++ b/http-push.c @@ -771,7 +771,7 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed) lock->owner = xmalloc(strlen(ctx->cdata) + 1); strcpy(lock->owner, ctx->cdata); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TIMEOUT)) { - if (!prefixcmp(ctx->cdata, "Second-")) + if (starts_with(ctx->cdata, "Second-")) lock->timeout = strtol(ctx->cdata + 7, NULL, 10); } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) { @@ -1579,7 +1579,7 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1) return; /* If it's a symref, set the refname; otherwise try for a sha1 */ - if (!prefixcmp((char *)buffer.buf, "ref: ")) { + if (starts_with((char *)buffer.buf, "ref: ")) { *symref = xmemdupz((char *)buffer.buf + 5, buffer.len - 6); } else { get_sha1_hex(buffer.buf, sha1); |