summaryrefslogtreecommitdiff
path: root/reftable/basics.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-06-07 10:32:02 -0700
committerJunio C Hamano <gitster@pobox.com>2024-06-07 10:32:02 -0700
commit79864519637f58c79d15ec5b49272c0580201af3 (patch)
tree071f437da1041a6000dbdcaeac68463958ffc9c1 /reftable/basics.c
parent6c5be97e4eee040a2d5303e5650fa7cc8a37dbd8 (diff)
parentd66fe0726bfb3fb1e3665f7e64b160440007d98e (diff)
Merge branch 'ps/no-writable-strings' into jk/imap-send-plug-all-msgs-leak
* ps/no-writable-strings: (46 commits) config.mak.dev: enable `-Wwrite-strings` warning builtin/merge: always store allocated strings in `pull_twohead` builtin/rebase: always store allocated string in `options.strategy` builtin/rebase: do not assign default backend to non-constant field imap-send: fix leaking memory in `imap_server_conf` imap-send: drop global `imap_server_conf` variable mailmap: always store allocated strings in mailmap blob revision: always store allocated strings in output encoding remote-curl: avoid assigning string constant to non-const variable send-pack: always allocate receive status parse-options: cast long name for OPTION_ALIAS http: do not assign string constant to non-const field compat/win32: fix const-correctness with string constants pretty: add casts for decoration option pointers object-file: make `buf` parameter of `index_mem()` a constant object-file: mark cached object buffers as const ident: add casts for fallback name and GECOS entry: refactor how we remove items for delayed checkouts line-log: always allocate the output prefix line-log: stop assigning string constant to file parent buffer ...
Diffstat (limited to 'reftable/basics.c')
-rw-r--r--reftable/basics.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/reftable/basics.c b/reftable/basics.c
index fea711db7e..0058619ca6 100644
--- a/reftable/basics.c
+++ b/reftable/basics.c
@@ -67,9 +67,9 @@ void free_names(char **a)
reftable_free(a);
}
-size_t names_length(char **names)
+size_t names_length(const char **names)
{
- char **p = names;
+ const char **p = names;
while (*p)
p++;
return p - names;
@@ -102,15 +102,12 @@ void parse_names(char *buf, int size, char ***namesp)
*namesp = names;
}
-int names_equal(char **a, char **b)
+int names_equal(const char **a, const char **b)
{
- int i = 0;
- for (; a[i] && b[i]; i++) {
- if (strcmp(a[i], b[i])) {
+ size_t i = 0;
+ for (; a[i] && b[i]; i++)
+ if (strcmp(a[i], b[i]))
return 0;
- }
- }
-
return a[i] == b[i];
}