diff options
| author | René Scharfe <l.s.r@web.de> | 2024-02-10 08:43:01 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-02-12 09:32:41 -0800 |
| commit | f0e578c69cd91a554179c09dab6989f6eb0e2910 (patch) | |
| tree | 0f0e026d645a86529a80a2237f78329534cd5ba1 /builtin/fast-export.c | |
| parent | 3526e67d917bcd03f317a058208fa02737654637 (diff) | |
use xstrncmpz()
Add and apply a semantic patch for calling xstrncmpz() to compare a
NUL-terminated string with a buffer of a known length instead of using
strncmp() and checking the terminating NUL explicitly. This simplifies
callers by reducing code duplication.
I had to adjust remote.c manually because Coccinelle inexplicably
changed the indent of the else branches.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fast-export.c')
| -rw-r--r-- | builtin/fast-export.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c index f18f0809f9..4693d18cc9 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -136,8 +136,7 @@ static int anonymized_entry_cmp(const void *cmp_data UNUSED, a = container_of(eptr, const struct anonymized_entry, hash); if (keydata) { const struct anonymized_entry_key *key = keydata; - int equal = !strncmp(a->orig, key->orig, key->orig_len) && - !a->orig[key->orig_len]; + int equal = !xstrncmpz(a->orig, key->orig, key->orig_len); return !equal; } |
