aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-02-13 13:39:24 -0800
committerJunio C Hamano <gitster@pobox.com>2026-02-13 13:39:25 -0800
commit7855effc952777f2fac284e4461743cf5aa20ee6 (patch)
tree37cbf589a05604e1d2d3ca2aaaa6ce10867893f1 /builtin
parenta91de2172dac7e73de2088a7fdfeb532baa3bfca (diff)
parentfc9fd8065c6049243f50e90f00a847054ca15e28 (diff)
downloadgit-7855effc952777f2fac284e4461743cf5aa20ee6.tar.xz
Merge branch 'cf/c23-const-preserving-strchr-updates-0'
ISO C23 redefines strchr and friends that tradiotionally took a const pointer and returned a non-const pointer derived from it to preserve constness (i.e., if you ask for a substring in a const string, you get a const pointer to the substring). Update code paths that used non-const pointer to receive their results that did not have to be non-const to adjust. * cf/c23-const-preserving-strchr-updates-0: gpg-interface: remove an unnecessary NULL initialization global: constify some pointers that are not written to
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c2
-rw-r--r--builtin/receive-pack.c2
-rw-r--r--builtin/remote.c2
-rw-r--r--builtin/shortlog.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 8e901fe8db..0326546548 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -816,7 +816,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
logfile);
hook_arg1 = "message";
} else if (use_message) {
- char *buffer;
+ const char *buffer;
buffer = strstr(use_message_buffer, "\n\n");
if (buffer)
strbuf_addstr(&sb, skip_blank_lines(buffer + 2));
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index d1aacf8b2a..4c0112b4bc 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -393,7 +393,7 @@ struct command {
static void proc_receive_ref_append(const char *prefix)
{
struct proc_receive_ref *ref_pattern;
- char *p;
+ const char *p;
int len;
CALLOC_ARRAY(ref_pattern, 1);
diff --git a/builtin/remote.c b/builtin/remote.c
index 7ffc14ba15..ace390c671 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -332,7 +332,7 @@ static int config_read_branches(const char *key, const char *value,
info->remote_name = xstrdup(value);
break;
case MERGE: {
- char *space = strchr(value, ' ');
+ const char *space = strchr(value, ' ');
value = abbrev_branch(value);
while (space) {
char *merge;
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index b91acf45c8..d80bf1a7d0 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -76,7 +76,7 @@ static void insert_one_record(struct shortlog *log,
if (!eol)
eol = oneline + strlen(oneline);
if (starts_with(oneline, "[PATCH")) {
- char *eob = strchr(oneline, ']');
+ const char *eob = strchr(oneline, ']');
if (eob && (!eol || eob < eol))
oneline = eob + 1;
}