git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v6 01/27] global: improve const correctness when assigning string constants

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 7, 2024, 06:37 UTC
Message-ID
<ba50d960814054dade5fc17a18513d7e070ae71b.1717740366.git.ps@pks.im>
In-Reply-To
<cover.1717740365.git.ps@pks.im>

We're about to enable `-Wwrite-strings`, which changes the type of string constants to `const char[]`. Fix various sites where we assign such constants to non-const variables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 builtin/bisect.c             |  3 ++-
 builtin/blame.c              |  2 +-
 builtin/bugreport.c          |  2 +-
 builtin/check-ignore.c       |  4 +--
 builtin/clone.c              |  6 ++---
 builtin/commit.c             |  6 ++---
 builtin/diagnose.c           |  2 +-
 builtin/log.c                |  2 +-
 builtin/mailsplit.c          |  4 +--
 builtin/pull.c               | 52 ++++++++++++++++++------------------
 builtin/receive-pack.c       |  4 +--
 builtin/revert.c             |  2 +-
 compat/regex/regcomp.c       |  2 +-
 diff.c                       |  4 +--
 diffcore-rename.c            |  6 ++---
 fmt-merge-msg.c              |  2 +-
 fsck.c                       |  2 +-
 fsck.h                       |  2 +-
 gpg-interface.c              |  2 +-
 http-backend.c               |  2 +-
 imap-send.c                  |  6 ++---
 pretty.c                     |  2 +-
 refs.c                       |  2 +-
 refs.h                       |  2 +-
 reftable/basics.c            | 15 +++++------
 reftable/basics.h            |  4 +--
 reftable/basics_test.c       |  4 +--
 reftable/record.c            |  6 ++---
 reftable/stack.c             | 10 ++++---
 reftable/stack_test.c        |  8 +++---
 run-command.c                |  2 +-
 t/helper/test-hashmap.c      |  3 ++-
 t/helper/test-json-writer.c  | 10 +++----
 t/helper/test-regex.c        |  4 +--
 t/helper/test-rot13-filter.c |  5 ++--
 t/unit-tests/t-strbuf.c      | 10 ++++---
 trailer.c                    |  2 +-
 wt-status.c                  |  2 +-
 38 files changed, 106 insertions(+), 102 deletions(-)
diff --git a/builtin/bisect.c b/builtin/bisect.c
index a58432b9d9..dabce9b542 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -262,7 +262,8 @@ static int bisect_reset(const char *commit)
 	return bisect_clean_state();
 }
 
-static void log_commit(FILE *fp, char *fmt, const char *state,
+static void log_commit(FILE *fp,
+		       const char *fmt, const char *state,
 		       struct commit *commit)
 {
 	struct pretty_print_context pp = {0};
diff --git a/builtin/blame.c b/builtin/blame.c
index 838cd476be..98c7629b6a 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -134,7 +134,7 @@ static void get_ac_line(const char *inbuf, const char *what,
 {
 	struct ident_split ident;
 	size_t len, maillen, namelen;
-	char *tmp, *endp;
+	const char *tmp, *endp;
 	const char *namebuf, *mailbuf;
 
 	tmp = strstr(inbuf, what);
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 25f860a0d9..b3cc77af53 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -107,7 +107,7 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix)
 	struct tm tm;
 	enum diagnose_mode diagnose = DIAGNOSE_NONE;
 	char *option_output = NULL;
-	char *option_suffix = "%Y-%m-%d-%H%M";
+	const char *option_suffix = "%Y-%m-%d-%H%M";
 	const char *user_relative_path = NULL;
 	char *prefixed_filename;
 	size_t output_path_len;
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index 6c43430ec4..2bda6a1d46 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -35,8 +35,8 @@ static const struct option check_ignore_options[] = {
 
 static void output_pattern(const char *path, struct path_pattern *pattern)
 {
-	char *bang  = (pattern && pattern->flags & PATTERN_FLAG_NEGATIVE)  ? "!" : "";
-	char *slash = (pattern && pattern->flags & PATTERN_FLAG_MUSTBEDIR) ? "/" : "";
+	const char *bang  = (pattern && pattern->flags & PATTERN_FLAG_NEGATIVE)  ? "!" : "";
+	const char *slash = (pattern && pattern->flags & PATTERN_FLAG_MUSTBEDIR) ? "/" : "";
 	if (!nul_term_line) {
 		if (!verbose) {
 			write_name_quoted(path, stdout, '\n');
diff --git a/builtin/clone.c b/builtin/clone.c
index 23993b905b..92ab7d7165 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -71,7 +71,7 @@ static char *option_branch = NULL;
 static struct string_list option_not = STRING_LIST_INIT_NODUP;
 static const char *real_git_dir;
 static const char *ref_format;
-static char *option_upload_pack = "git-upload-pack";
+static const char *option_upload_pack = "git-upload-pack";
 static int option_verbosity;
 static int option_progress = -1;
 static int option_sparse_checkout;
@@ -177,8 +177,8 @@ static struct option builtin_clone_options[] = {
 
 static const char *get_repo_path_1(struct strbuf *path, int *is_bundle)
 {
-	static char *suffix[] = { "/.git", "", ".git/.git", ".git" };
-	static char *bundle_suffix[] = { ".bundle", "" };
+	static const char *suffix[] = { "/.git", "", ".git/.git", ".git" };
+	static const char *bundle_suffix[] = { ".bundle", "" };
 	size_t baselen = path->len;
 	struct stat st;
 	int i;
diff --git a/builtin/commit.c b/builtin/commit.c
index f53e7e86ff..75c741173e 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -113,7 +113,7 @@ static char *template_file;
  * the commit message and/or authorship.
  */
 static const char *author_message, *author_message_buffer;
-static char *edit_message, *use_message;
+static const char *edit_message, *use_message;
 static char *fixup_message, *fixup_commit, *squash_message;
 static const char *fixup_prefix;
 static int all, also, interactive, patch_interactive, only, amend, signoff;
@@ -121,8 +121,8 @@ static int edit_flag = -1; /* unspecified */
 static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
 static int config_commit_verbose = -1; /* unspecified */
 static int no_post_rewrite, allow_empty_message, pathspec_file_nul;
-static char *untracked_files_arg, *force_date, *ignore_submodule_arg, *ignored_arg;
-static char *sign_commit, *pathspec_from_file;
+static const char *untracked_files_arg, *force_date, *ignore_submodule_arg, *ignored_arg;
+static const char *sign_commit, *pathspec_from_file;
 static struct strvec trailer_args = STRVEC_INIT;
 
 /*
diff --git a/builtin/diagnose.c b/builtin/diagnose.c
index 4f22eb2b55..4857a4395b 100644
--- a/builtin/diagnose.c
+++ b/builtin/diagnose.c
@@ -18,7 +18,7 @@ int cmd_diagnose(int argc, const char **argv, const char *prefix)
 	struct tm tm;
 	enum diagnose_mode mode = DIAGNOSE_STATS;
 	char *option_output = NULL;
-	char *option_suffix = "%Y-%m-%d-%H%M";
+	const char *option_suffix = "%Y-%m-%d-%H%M";
 	char *prefixed_filename;
 
 	const struct option diagnose_options[] = {
diff --git a/builtin/log.c b/builtin/log.c
index 78a247d8a9..b8846a9458 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1283,7 +1283,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
 	o2->flags = flags2;
 }
 
-static void gen_message_id(struct rev_info *info, char *base)
+static void gen_message_id(struct rev_info *info, const char *base)
 {
 	struct strbuf buf = STRBUF_INIT;
 	strbuf_addf(&buf, "%s.%"PRItime".git.%s", base,
diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index 3af9ddb8ae..fe6dbc5d05 100644
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
@@ -113,8 +113,8 @@ static int populate_maildir_list(struct string_list *list, const char *path)
 	DIR *dir;
 	struct dirent *dent;
 	char *name = NULL;
-	char *subs[] = { "cur", "new", NULL };
-	char **sub;
+	const char *subs[] = { "cur", "new", NULL };
+	const char **sub;
 	int ret = -1;
 
 	for (sub = subs; *sub; ++sub) {
diff --git a/builtin/pull.c b/builtin/pull.c
index d622202bce..2d0429f14f 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -71,48 +71,48 @@ static const char * const pull_usage[] = {
 
 /* Shared options */
 static int opt_verbosity;
-static char *opt_progress;
+static const char *opt_progress;
 static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
 static int recurse_submodules_cli = RECURSE_SUBMODULES_DEFAULT;
 
 /* Options passed to git-merge or git-rebase */
 static enum rebase_type opt_rebase = -1;
-static char *opt_diffstat;
-static char *opt_log;
-static char *opt_signoff;
-static char *opt_squash;
-static char *opt_commit;
-static char *opt_edit;
-static char *cleanup_arg;
-static char *opt_ff;
-static char *opt_verify_signatures;
-static char *opt_verify;
+static const char *opt_diffstat;
+static const char *opt_log;
+static const char *opt_signoff;
+static const char *opt_squash;
+static const char *opt_commit;
+static const char *opt_edit;
+static const char *cleanup_arg;
+static const char *opt_ff;
+static const char *opt_verify_signatures;
+static const char *opt_verify;
 static int opt_autostash = -1;
 static int config_autostash;
 static int check_trust_level = 1;
 static struct strvec opt_strategies = STRVEC_INIT;
 static struct strvec opt_strategy_opts = STRVEC_INIT;
-static char *opt_gpg_sign;
+static const char *opt_gpg_sign;
 static int opt_allow_unrelated_histories;
 
 /* Options passed to git-fetch */
-static char *opt_all;
-static char *opt_append;
-static char *opt_upload_pack;
+static const char *opt_all;
+static const char *opt_append;
+static const char *opt_upload_pack;
 static int opt_force;
-static char *opt_tags;
-static char *opt_prune;
-static char *max_children;
+static const char *opt_tags;
+static const char *opt_prune;
+static const char *max_children;
 static int opt_dry_run;
-static char *opt_keep;
-static char *opt_depth;
-static char *opt_unshallow;
-static char *opt_update_shallow;
-static char *opt_refmap;
-static char *opt_ipv4;
-static char *opt_ipv6;
+static const char *opt_keep;
+static const char *opt_depth;
+static const char *opt_unshallow;
+static const char *opt_update_shallow;
+static const char *opt_refmap;
+static const char *opt_ipv4;
+static const char *opt_ipv6;
 static int opt_show_forced_updates = -1;
-static char *set_upstream;
+static const char *set_upstream;
 static struct strvec opt_fetch = STRVEC_INIT;
 
 static struct option pull_options[] = {
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 01c1f04ece..c8d12ee0a7 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1249,7 +1249,7 @@ static int run_proc_receive_hook(struct command *commands,
 	return code;
 }
 
-static char *refuse_unconfigured_deny_msg =
+static const char *refuse_unconfigured_deny_msg =
 	N_("By default, updating the current branch in a non-bare repository\n"
 	   "is denied, because it will make the index and work tree inconsistent\n"
 	   "with what you pushed, and will require 'git reset --hard' to match\n"
@@ -1269,7 +1269,7 @@ static void refuse_unconfigured_deny(void)
 	rp_error("%s", _(refuse_unconfigured_deny_msg));
 }
 
-static char *refuse_unconfigured_deny_delete_current_msg =
+static const char *refuse_unconfigured_deny_delete_current_msg =
 	N_("By default, deleting the current branch is denied, because the next\n"
 	   "'git clone' won't result in any file checked out, causing confusion.\n"
 	   "\n"
diff --git a/builtin/revert.c b/builtin/revert.c
index 53935d2c68..7bf2b4e11d 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -179,7 +179,7 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,
 
 	/* Check for incompatible command line arguments */
 	if (cmd) {
-		char *this_operation;
+		const char *this_operation;
 		if (cmd == 'q')
 			this_operation = "--quit";
 		else if (cmd == 'c')
diff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c
index 2bc0f1187a..6c5d455e92 100644
--- a/compat/regex/regcomp.c
+++ b/compat/regex/regcomp.c
@@ -848,7 +848,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
 {
   unsigned int table_size;
 #ifndef _LIBC
-  char *codeset_name;
+  const char *codeset_name;
 #endif
 
   memset (dfa, '\0', sizeof (re_dfa_t));
diff --git a/diff.c b/diff.c
index e70301df76..ffd867ef6c 100644
--- a/diff.c
+++ b/diff.c
@@ -3764,7 +3764,7 @@ static void builtin_diff(const char *name_a,
 	return;
 }
 
-static char *get_compact_summary(const struct diff_filepair *p, int is_renamed)
+static const char *get_compact_summary(const struct diff_filepair *p, int is_renamed)
 {
 	if (!is_renamed) {
 		if (p->status == DIFF_STATUS_ADDED) {
@@ -4076,7 +4076,7 @@ static int reuse_worktree_file(struct index_state *istate,
 static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
 {
 	struct strbuf buf = STRBUF_INIT;
-	char *dirty = "";
+	const char *dirty = "";
 
 	/* Are we looking at the work tree? */
 	if (s->dirty_submodule)
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 5a6e2bcac7..0e1adb87df 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -406,7 +406,7 @@ static const char *get_highest_rename_path(struct strintmap *counts)
 	return highest_destination_dir;
 }
 
-static char *UNKNOWN_DIR = "/";  /* placeholder -- short, illegal directory */
+static const char *UNKNOWN_DIR = "/";  /* placeholder -- short, illegal directory */
 
 static int dir_rename_already_determinable(struct strintmap *counts)
 {
@@ -429,8 +429,8 @@ static int dir_rename_already_determinable(struct strintmap *counts)
 }
 
 static void increment_count(struct dir_rename_info *info,
-			    char *old_dir,
-			    char *new_dir)
+			    const char *old_dir,
+			    const char *new_dir)
 {
 	struct strintmap *counts;
 	struct strmap_entry *e;
diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
index 7d144b803a..5af63ab5ab 100644
--- a/fmt-merge-msg.c
+++ b/fmt-merge-msg.c
@@ -447,7 +447,7 @@ static void fmt_merge_msg_title(struct strbuf *out,
 				const char *current_branch)
 {
 	int i = 0;
-	char *sep = "";
+	const char *sep = "";
 
 	strbuf_addstr(out, "Merge ");
 	for (i = 0; i < srcs.nr; i++) {
diff --git a/fsck.c b/fsck.c
index 7dff41413e..61cd48aa25 100644
--- a/fsck.c
+++ b/fsck.c
@@ -1231,7 +1231,7 @@ int fsck_object(struct object *obj, void *data, unsigned long size,
 }
 
 int fsck_buffer(const struct object_id *oid, enum object_type type,
-		void *data, unsigned long size,
+		const void *data, unsigned long size,
 		struct fsck_options *options)
 {
 	if (type == OBJ_BLOB)
diff --git a/fsck.h b/fsck.h
index 17fa2dda5d..4f0c4e6479 100644
--- a/fsck.h
+++ b/fsck.h
@@ -202,7 +202,7 @@ int fsck_object(struct object *obj, void *data, unsigned long size,
  * struct.
  */
 int fsck_buffer(const struct object_id *oid, enum object_type,
-		void *data, unsigned long size,
+		const void *data, unsigned long size,
 		struct fsck_options *options);
 
 /*
diff --git a/gpg-interface.c b/gpg-interface.c
index 5193223714..71a9382a61 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -727,7 +727,7 @@ static int git_gpg_config(const char *var, const char *value,
 			  void *cb UNUSED)
 {
 	struct gpg_format *fmt = NULL;
-	char *fmtname = NULL;
+	const char *fmtname = NULL;
 	char *trust;
 	int ret;
 
diff --git a/http-backend.c b/http-backend.c
index 5b65287ac9..5b4dca65ed 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -753,7 +753,7 @@ static int bad_request(struct strbuf *hdr, const struct service_cmd *c)
 
 int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
-	char *method = getenv("REQUEST_METHOD");
+	const char *method = getenv("REQUEST_METHOD");
 	const char *proto_header;
 	char *dir;
 	struct service_cmd *cmd = NULL;
diff --git a/imap-send.c b/imap-send.c
index a5d1510180..8b723b34a5 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1215,9 +1215,9 @@ static int imap_store_msg(struct imap_store *ctx, struct strbuf *msg)
 static void wrap_in_html(struct strbuf *msg)
 {
 	struct strbuf buf = STRBUF_INIT;
-	static char *content_type = "Content-Type: text/html;\n";
-	static char *pre_open = "<pre>\n";
-	static char *pre_close = "</pre>\n";
+	static const char *content_type = "Content-Type: text/html;\n";
+	static const char *pre_open = "<pre>\n";
+	static const char *pre_close = "</pre>\n";
 	const char *body = strstr(msg->buf, "\n\n");
 
 	if (!body)
diff --git a/pretty.c b/pretty.c
index 22a81506b7..ec05db5655 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1325,7 +1325,7 @@ int format_set_trailers_options(struct process_trailer_options *opts,
 static size_t parse_describe_args(const char *start, struct strvec *args)
 {
 	struct {
-		char *name;
+		const char *name;
 		enum {
 			DESCRIBE_ARG_BOOL,
 			DESCRIBE_ARG_INTEGER,
diff --git a/refs.c b/refs.c
index 8260c27cde..292e8d947e 100644
--- a/refs.c
+++ b/refs.c
@@ -159,7 +159,7 @@ void update_ref_namespace(enum ref_namespace namespace, char *ref)
 {
 	struct ref_namespace_info *info = &ref_namespace[namespace];
 	if (info->ref_updated)
-		free(info->ref);
+		free((char *)info->ref);
 	info->ref = ref;
 	info->ref_updated = 1;
 }
diff --git a/refs.h b/refs.h
index 34568ee1fb..923f751d18 100644
--- a/refs.h
+++ b/refs.h
@@ -975,7 +975,7 @@ struct ref_store *get_worktree_ref_store(const struct worktree *wt);
  */
 
 struct ref_namespace_info {
-	char *ref;
+	const char *ref;
 	enum decoration_type decoration;
 
 	/*
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];
 }
 
diff --git a/reftable/basics.h b/reftable/basics.h
index 523ecd5307..c8fec68d4e 100644
--- a/reftable/basics.h
+++ b/reftable/basics.h
@@ -42,10 +42,10 @@ void free_names(char **a);
 void parse_names(char *buf, int size, char ***namesp);
 
 /* compares two NULL-terminated arrays of strings. */
-int names_equal(char **a, char **b);
+int names_equal(const char **a, const char **b);
 
 /* returns the array size of a NULL-terminated array of strings. */
-size_t names_length(char **names);
+size_t names_length(const char **names);
 
 /* Allocation routines; they invoke the functions set through
  * reftable_set_alloc() */
diff --git a/reftable/basics_test.c b/reftable/basics_test.c
index 997c4d9e01..13bc761817 100644
--- a/reftable/basics_test.c
+++ b/reftable/basics_test.c
@@ -58,8 +58,8 @@ static void test_binsearch(void)
 
 static void test_names_length(void)
 {
-	char *a[] = { "a", "b", NULL };
-	EXPECT(names_length(a) == 2);
+	const char *names[] = { "a", "b", NULL };
+	EXPECT(names_length(names) == 2);
 }
 
 static void test_parse_names_normal(void)
diff --git a/reftable/record.c b/reftable/record.c
index 5506f3e913..a2cba5ef74 100644
--- a/reftable/record.c
+++ b/reftable/record.c
@@ -116,7 +116,7 @@ static int decode_string(struct strbuf *dest, struct string_view in)
 	return start_len - in.len;
 }
 
-static int encode_string(char *str, struct string_view s)
+static int encode_string(const char *str, struct string_view s)
 {
 	struct string_view start = s;
 	int l = strlen(str);
@@ -969,9 +969,9 @@ static int reftable_log_record_decode(void *rec, struct strbuf key,
 	return REFTABLE_FORMAT_ERROR;
 }
 
-static int null_streq(char *a, char *b)
+static int null_streq(const char *a, const char *b)
 {
-	char *empty = "";
+	const char *empty = "";
 	if (!a)
 		a = empty;
 
diff --git a/reftable/stack.c b/reftable/stack.c
index a59ebe038d..09549c51c9 100644
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@ -204,7 +204,8 @@ static struct reftable_reader **stack_copy_readers(struct reftable_stack *st,
 	return cur;
 }
 
-static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
+static int reftable_stack_reload_once(struct reftable_stack *st,
+				      const char **names,
 				      int reuse_open)
 {
 	size_t cur_len = !st->merged ? 0 : st->merged->stack_len;
@@ -222,7 +223,7 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
 
 	while (*names) {
 		struct reftable_reader *rd = NULL;
-		char *name = *names++;
+		const char *name = *names++;
 
 		/* this is linear; we assume compaction keeps the number of
 		   tables under control so this is not quadratic. */
@@ -354,7 +355,7 @@ static int reftable_stack_reload_maybe_reuse(struct reftable_stack *st,
 				goto out;
 		}
 
-		err = reftable_stack_reload_once(st, names, reuse_open);
+		err = reftable_stack_reload_once(st, (const char **) names, reuse_open);
 		if (!err)
 			break;
 		if (err != REFTABLE_NOT_EXIST_ERROR)
@@ -368,7 +369,8 @@ static int reftable_stack_reload_maybe_reuse(struct reftable_stack *st,
 		err = read_lines(st->list_file, &names_after);
 		if (err < 0)
 			goto out;
-		if (names_equal(names_after, names)) {
+		if (names_equal((const char **) names_after,
+				(const char **) names)) {
 			err = REFTABLE_NOT_EXIST_ERROR;
 			goto out;
 		}
diff --git a/reftable/stack_test.c b/reftable/stack_test.c
index 7889f818d1..07d89b45da 100644
--- a/reftable/stack_test.c
+++ b/reftable/stack_test.c
@@ -83,7 +83,7 @@ static void test_read_file(void)
 	char out[1024] = "line1\n\nline2\nline3";
 	int n, err;
 	char **names = NULL;
-	char *want[] = { "line1", "line2", "line3" };
+	const char *want[] = { "line1", "line2", "line3" };
 	int i = 0;
 
 	EXPECT(fd > 0);
@@ -116,9 +116,9 @@ static void test_parse_names(void)
 
 static void test_names_equal(void)
 {
-	char *a[] = { "a", "b", "c", NULL };
-	char *b[] = { "a", "b", "d", NULL };
-	char *c[] = { "a", "b", NULL };
+	const char *a[] = { "a", "b", "c", NULL };
+	const char *b[] = { "a", "b", "d", NULL };
+	const char *c[] = { "a", "b", NULL };
 
 	EXPECT(names_equal(a, a));
 	EXPECT(!names_equal(a, b));
diff --git a/run-command.c b/run-command.c
index 1b821042b4..7600531fb6 100644
--- a/run-command.c
+++ b/run-command.c
@@ -663,7 +663,7 @@ int start_command(struct child_process *cmd)
 	int need_in, need_out, need_err;
 	int fdin[2], fdout[2], fderr[2];
 	int failed_errno;
-	char *str;
+	const char *str;
 
 	/*
 	 * In case of errors we must keep the promise to close FDs
diff --git a/t/helper/test-hashmap.c b/t/helper/test-hashmap.c
index 0eb0b3d49c..2912899558 100644
--- a/t/helper/test-hashmap.c
+++ b/t/helper/test-hashmap.c
@@ -36,7 +36,8 @@ static int test_entry_cmp(const void *cmp_data,
 }
 
 static struct test_entry *alloc_test_entry(unsigned int hash,
-					   char *key, char *value)
+					   const char *key,
+					   const char *value)
 {
 	size_t klen = strlen(key);
 	size_t vlen = strlen(value);
diff --git a/t/helper/test-json-writer.c b/t/helper/test-json-writer.c
index afe393f597..ed52eb76bf 100644
--- a/t/helper/test-json-writer.c
+++ b/t/helper/test-json-writer.c
@@ -174,7 +174,7 @@ static void make_arr4(int pretty)
 	jw_end(&arr4);
 }
 
-static char *expect_nest1 =
+static const char *expect_nest1 =
 	"{\"obj1\":{\"a\":\"abc\",\"b\":42,\"c\":true},\"arr1\":[\"abc\",42,true]}";
 
 static struct json_writer nest1 = JSON_WRITER_INIT;
@@ -195,10 +195,10 @@ static void make_nest1(int pretty)
 	jw_release(&arr1);
 }
 
-static char *expect_inline1 =
+static const char *expect_inline1 =
 	"{\"obj1\":{\"a\":\"abc\",\"b\":42,\"c\":true},\"arr1\":[\"abc\",42,true]}";
 
-static char *pretty_inline1 =
+static const char *pretty_inline1 =
 	("{\n"
 	 "  \"obj1\": {\n"
 	 "    \"a\": \"abc\",\n"
@@ -236,10 +236,10 @@ static void make_inline1(int pretty)
 	jw_end(&inline1);
 }
 
-static char *expect_inline2 =
+static const char *expect_inline2 =
 	"[[1,2],[3,4],{\"a\":\"abc\"}]";
 
-static char *pretty_inline2 =
+static const char *pretty_inline2 =
 	("[\n"
 	 "  [\n"
 	 "    1,\n"
diff --git a/t/helper/test-regex.c b/t/helper/test-regex.c
index 80042eafc2..366bd70976 100644
--- a/t/helper/test-regex.c
+++ b/t/helper/test-regex.c
@@ -20,8 +20,8 @@ static struct reg_flag reg_flags[] = {
 
 static int test_regex_bug(void)
 {
-	char *pat = "[^={} \t]+";
-	char *str = "={}\nfred";
+	const char *pat = "[^={} \t]+";
+	const char *str = "={}\nfred";
 	regex_t r;
 	regmatch_t m[1];
 
diff --git a/t/helper/test-rot13-filter.c b/t/helper/test-rot13-filter.c
index f8d564c622..7e1d9e0ee4 100644
--- a/t/helper/test-rot13-filter.c
+++ b/t/helper/test-rot13-filter.c
@@ -136,7 +136,7 @@ static void free_delay_entries(void)
 	strmap_clear(&delay, 0);
 }
 
-static void add_delay_entry(char *pathname, int count, int requested)
+static void add_delay_entry(const char *pathname, int count, int requested)
 {
 	struct delay_entry *entry = xcalloc(1, sizeof(*entry));
 	entry->count = count;
@@ -189,7 +189,8 @@ static void reply_list_available_blobs_cmd(void)
 static void command_loop(void)
 {
 	for (;;) {
-		char *buf, *output;
+		char *buf;
+		const char *output;
 		char *pathname;
 		struct delay_entry *entry;
 		struct strbuf input = STRBUF_INIT;
diff --git a/t/unit-tests/t-strbuf.c b/t/unit-tests/t-strbuf.c
index de434a4441..6027dafef7 100644
--- a/t/unit-tests/t-strbuf.c
+++ b/t/unit-tests/t-strbuf.c
@@ -2,7 +2,8 @@
 #include "strbuf.h"
 
 /* wrapper that supplies tests with an empty, initialized strbuf */
-static void setup(void (*f)(struct strbuf*, void*), void *data)
+static void setup(void (*f)(struct strbuf*, const void*),
+		  const void *data)
 {
 	struct strbuf buf = STRBUF_INIT;
 
@@ -13,7 +14,8 @@ static void setup(void (*f)(struct strbuf*, void*), void *data)
 }
 
 /* wrapper that supplies tests with a populated, initialized strbuf */
-static void setup_populated(void (*f)(struct strbuf*, void*), char *init_str, void *data)
+static void setup_populated(void (*f)(struct strbuf*, const void*),
+			    const char *init_str, const void *data)
 {
 	struct strbuf buf = STRBUF_INIT;
 
@@ -64,7 +66,7 @@ static void t_dynamic_init(void)
 	strbuf_release(&buf);
 }
 
-static void t_addch(struct strbuf *buf, void *data)
+static void t_addch(struct strbuf *buf, const void *data)
 {
 	const char *p_ch = data;
 	const char ch = *p_ch;
@@ -83,7 +85,7 @@ static void t_addch(struct strbuf *buf, void *data)
 	check_char(buf->buf[buf->len], ==, '\0');
 }
 
-static void t_addstr(struct strbuf *buf, void *data)
+static void t_addstr(struct strbuf *buf, const void *data)
 {
 	const char *text = data;
 	size_t len = strlen(text);
diff --git a/trailer.c b/trailer.c
index 2bcb9ba8f7..72e5136c73 100644
--- a/trailer.c
+++ b/trailer.c
@@ -63,7 +63,7 @@ struct arg_item {
 
 static LIST_HEAD(conf_head);
 
-static char *separators = ":";
+static const char *separators = ":";
 
 static int configured;
 
diff --git a/wt-status.c b/wt-status.c
index ff4be071ca..7912545e4e 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -2408,7 +2408,7 @@ static void wt_porcelain_v2_print_unmerged_entry(
 		int mode;
 		struct object_id oid;
 	} stages[3];
-	char *key;
+	const char *key;
 	char submodule_token[5];
 	char unmerged_prefix = 'u';
 	char eol_char = s->null_termination ? '\0' : '\n';
-- 
2.45.2.436.gcd77e87115.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 178 of 205 in “Compile with `-Wwrite-strings`”
  1. 00/19 Compile with `-Wwrite-strings`Patrick Steinhardt, May 29, 2024
  2. 01/19 global: improve const correctness when assigning string constantsPatrick Steinhardt, May 29, 2024
  3. Junio C HamanoMay 29, 2024
  4. Patrick SteinhardtMay 30, 2024
  5. 02/19 global: assign non-const strings as requiredPatrick Steinhardt, May 29, 2024
  6. Junio C HamanoMay 29, 2024
  7. Patrick SteinhardtMay 30, 2024
  8. Junio C HamanoMay 30, 2024
  9. Patrick SteinhardtMay 31, 2024
  10. Patrick SteinhardtMay 31, 2024
  11. Junio C HamanoMay 31, 2024
  12. Junio C HamanoMay 31, 2024
  13. Jeff KingJun 5, 2024
  14. Junio C HamanoJun 5, 2024
  15. Jeff KingJun 8, 2024
  16. Patrick SteinhardtJun 6, 2024
  17. 03/19 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, May 29, 2024
  18. Junio C HamanoMay 29, 2024
  19. Patrick SteinhardtMay 30, 2024
  20. Junio C HamanoMay 30, 2024
  21. 04/19 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, May 29, 2024
  22. 05/19 reftable: improve const correctness when assigning string constantsPatrick Steinhardt, May 29, 2024
  23. Junio C HamanoMay 29, 2024
  24. Patrick SteinhardtMay 30, 2024
  25. Junio C HamanoMay 30, 2024
  26. 06/19 refspec: remove global tag refspec structurePatrick Steinhardt, May 29, 2024
  27. Junio C HamanoMay 29, 2024
  28. 07/19 http: do not assign string constant to non-const fieldPatrick Steinhardt, May 29, 2024
  29. Junio C HamanoMay 29, 2024
  30. 08/19 line-log: always allocate the output prefixPatrick Steinhardt, May 29, 2024
  31. Junio C HamanoMay 29, 2024
  32. 09/19 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, May 29, 2024
  33. Junio C HamanoMay 29, 2024
  34. 10/19 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, May 29, 2024
  35. 11/19 send-pack: always allocate receive statusPatrick Steinhardt, May 29, 2024
  36. 12/19 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, May 29, 2024
  37. Junio C HamanoMay 29, 2024
  38. Patrick SteinhardtMay 30, 2024
  39. 13/19 revision: always store allocated strings in output encodingPatrick Steinhardt, May 29, 2024
  40. Junio C HamanoMay 29, 2024
  41. 14/19 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, May 29, 2024
  42. 15/19 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, May 29, 2024
  43. 16/19 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, May 29, 2024
  44. Junio C HamanoMay 29, 2024
  45. Patrick SteinhardtMay 30, 2024
  46. Junio C HamanoMay 30, 2024
  47. 17/19 builtin/rebase: adapt code to not assign string constants to non-constPatrick Steinhardt, May 29, 2024
  48. Junio C HamanoMay 29, 2024
  49. Patrick SteinhardtMay 30, 2024
  50. 18/19 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, May 29, 2024
  51. 19/19 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, May 29, 2024
  52. Patrick SteinhardtMay 29, 2024
  53. 00/19 Compile with `-Wwrite-strings`Patrick Steinhardt, May 30, 2024
  54. 01/19 global: improve const correctness when assigning string constantsPatrick Steinhardt, May 30, 2024
  55. 02/19 global: assign non-const strings as requiredPatrick Steinhardt, May 30, 2024
  56. 03/19 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, May 30, 2024
  57. 04/19 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, May 30, 2024
  58. 05/19 refspec: remove global tag refspec structurePatrick Steinhardt, May 30, 2024
  59. 06/19 http: do not assign string constant to non-const fieldPatrick Steinhardt, May 30, 2024
  60. 07/19 line-log: always allocate the output prefixPatrick Steinhardt, May 30, 2024
  61. 08/19 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, May 30, 2024
  62. 09/19 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, May 30, 2024
  63. 10/19 send-pack: always allocate receive statusPatrick Steinhardt, May 30, 2024
  64. 11/19 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, May 30, 2024
  65. 12/19 revision: always store allocated strings in output encodingPatrick Steinhardt, May 30, 2024
  66. 13/19 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, May 30, 2024
  67. 14/19 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, May 30, 2024
  68. 15/19 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, May 30, 2024
  69. 16/19 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, May 30, 2024
  70. 17/19 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, May 30, 2024
  71. 18/19 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, May 30, 2024
  72. 19/19 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, May 30, 2024
  73. Junio C HamanoMay 31, 2024
  74. Patrick SteinhardtMay 31, 2024
  75. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 3, 2024
  76. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 3, 2024
  77. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 3, 2024
  78. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 3, 2024
  79. Junio C HamanoJun 3, 2024
  80. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 3, 2024
  81. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 3, 2024
  82. Junio C HamanoJun 3, 2024
  83. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 3, 2024
  84. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 3, 2024
  85. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 3, 2024
  86. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 3, 2024
  87. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 3, 2024
  88. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 3, 2024
  89. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 3, 2024
  90. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 3, 2024
  91. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 3, 2024
  92. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 3, 2024
  93. Eric SunshineJun 3, 2024
  94. Junio C HamanoJun 3, 2024
  95. Patrick SteinhardtJun 4, 2024
  96. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 3, 2024
  97. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 3, 2024
  98. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 3, 2024
  99. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 3, 2024
  100. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 3, 2024
  101. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 3, 2024
  102. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 3, 2024
  103. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 3, 2024
  104. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 3, 2024
  105. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 3, 2024
  106. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 3, 2024
  107. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 3, 2024
  108. Junio C HamanoJun 3, 2024
  109. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 4, 2024
  110. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 4, 2024
  111. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 4, 2024
  112. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 4, 2024
  113. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 4, 2024
  114. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 4, 2024
  115. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 4, 2024
  116. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 4, 2024
  117. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 4, 2024
  118. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 4, 2024
  119. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 4, 2024
  120. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 4, 2024
  121. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 4, 2024
  122. Junio C HamanoJun 6, 2024
  123. Junio C HamanoJun 6, 2024
  124. Patrick SteinhardtJun 6, 2024
  125. Junio C HamanoJun 6, 2024
  126. Patrick SteinhardtJun 7, 2024
  127. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 4, 2024
  128. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 4, 2024
  129. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 4, 2024
  130. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 4, 2024
  131. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 4, 2024
  132. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 4, 2024
  133. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 4, 2024
  134. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 4, 2024
  135. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 4, 2024
  136. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 4, 2024
  137. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 4, 2024
  138. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 4, 2024
  139. Phillip WoodJun 4, 2024
  140. Patrick SteinhardtJun 5, 2024
  141. Phillip WoodJun 5, 2024
  142. Patrick SteinhardtJun 6, 2024
  143. Junio C HamanoJun 5, 2024
  144. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 4, 2024
  145. Phillip WoodJun 4, 2024
  146. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 4, 2024
  147. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 4, 2024
  148. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 6, 2024
  149. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 6, 2024
  150. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 6, 2024
  151. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 6, 2024
  152. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 6, 2024
  153. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 6, 2024
  154. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 6, 2024
  155. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 6, 2024
  156. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 6, 2024
  157. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 6, 2024
  158. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 6, 2024
  159. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 6, 2024
  160. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 6, 2024
  161. Junio C HamanoJun 6, 2024
  162. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 6, 2024
  163. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 6, 2024
  164. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 6, 2024
  165. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 6, 2024
  166. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 6, 2024
  167. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 6, 2024
  168. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 6, 2024
  169. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 6, 2024
  170. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 6, 2024
  171. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 6, 2024
  172. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 6, 2024
  173. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 6, 2024
  174. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 6, 2024
  175. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 6, 2024
  176. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 6, 2024
  177. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 7, 2024
  178. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 7, 2024
  179. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 7, 2024
  180. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 7, 2024
  181. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 7, 2024
  182. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 7, 2024
  183. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 7, 2024
  184. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 7, 2024
  185. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 7, 2024
  186. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 7, 2024
  187. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 7, 2024
  188. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 7, 2024
  189. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 7, 2024
  190. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 7, 2024
  191. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 7, 2024
  192. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 7, 2024
  193. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 7, 2024
  194. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 7, 2024
  195. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 7, 2024
  196. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 7, 2024
  197. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 7, 2024
  198. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 7, 2024
  199. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 7, 2024
  200. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 7, 2024
  201. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 7, 2024
  202. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 7, 2024
  203. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 7, 2024
  204. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 7, 2024
  205. Junio C HamanoJun 7, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.