diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-02-26 18:10:24 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-26 18:10:24 -0800 |
commit | 274400998b0a2da64d20e9fa95b288bf1403459c (patch) | |
tree | 520059d779f2d3e93ab4ba91e4bc9e0bb8d37313 /builtin | |
parent | cf47fb7ec7e183a1a1e521a540862fba3c2a89eb (diff) | |
parent | f0e578c69cd91a554179c09dab6989f6eb0e2910 (diff) | |
download | git-274400998b0a2da64d20e9fa95b288bf1403459c.tar.gz |
Merge branch 'rs/use-xstrncmpz'
Code clean-up.
* rs/use-xstrncmpz:
use xstrncmpz()
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fast-export.c | 3 | ||||
-rw-r--r-- | builtin/merge.c | 3 | ||||
-rw-r--r-- | builtin/reflog.c | 3 |
3 files changed, 3 insertions, 6 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; } diff --git a/builtin/merge.c b/builtin/merge.c index 8f819781cc..935c8a57dd 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -192,8 +192,7 @@ static struct strategy *get_strategy(const char *name) int j, found = 0; struct cmdname *ent = main_cmds.names[i]; for (j = 0; !found && j < ARRAY_SIZE(all_strategy); j++) - if (!strncmp(ent->name, all_strategy[j].name, ent->len) - && !all_strategy[j].name[ent->len]) + if (!xstrncmpz(all_strategy[j].name, ent->name, ent->len)) found = 1; if (!found) add_cmdname(¬_strategies, ent->name, ent->len); diff --git a/builtin/reflog.c b/builtin/reflog.c index a5a4099f61..2c3369fca5 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -96,8 +96,7 @@ static struct reflog_expire_cfg *find_cfg_ent(const char *pattern, size_t len) reflog_expire_cfg_tail = &reflog_expire_cfg; for (ent = reflog_expire_cfg; ent; ent = ent->next) - if (!strncmp(ent->pattern, pattern, len) && - ent->pattern[len] == '\0') + if (!xstrncmpz(ent->pattern, pattern, len)) return ent; FLEX_ALLOC_MEM(ent, pattern, pattern, len); |