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

Re: [PATCH 02/19] global: assign non-const strings as required

From
Jeff King <peff@peff.net>
Date
Jun 8, 2024, 10:59 UTC
Message-ID
<20240608105929.GA2966571@coredump.intra.peff.net>
In-Reply-To
<xmqqplsvtirr.fsf@gitster.g>
On Wed, Jun 05, 2024 at 10:13:28AM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > On Fri, May 31, 2024 at 08:27:13AM -0700, Junio C Hamano wrote:
> >
> >> I wonder if we can do something to separate these two concerns
> >> apart, using a trick similar to what we often use with an extra
> >> variable "to_free".  Doing so would bloat the refspec_item, but
> >> unlike the references themselves, there won't be thousands of them,
> >> so it may not be an issue, perhaps?
> >
> > I had a similar thought while looking at this spot a while ago, so I dug
> > this attempt out of my stash. It's quite ugly, as you need to keep the
> > storage pointer and the const pointer in sync. Especially because
> > there's a lot of clever pointer indirection via match_name_with_pattern().
> 
> Ah, true.  The patch itself does not look _too_ bad, but that may
> simply be because the original is bad enough ;-)

A lot of it is not how bad the patch itself looks, but how hard it was to write. Each site which touches "src" needs to consider whether it should be "src_storage", and there was a lot of running the test suite with ASan, followed by head-scratching. I _think_ I got all of the right spots, but who knows. ;)

Anyway, I think Patrick is quite sensible in not pursuing it further for this series. But just for posterity, here's a slightly less invasive version of the patch I showed earlier. I had added an extra arguments to match_name_with_pattern() to auto-assign the "const" version, but it turned out that only one caller cared about it (and had to manually assign the const version in its fallback code path anyway!).

So this version has a little less noise in it.
---
 branch.c         |  6 +++---
 builtin/fetch.c  |  8 ++++----
 builtin/remote.c |  6 +++---
 checkout.c       | 13 +++++++------
 refspec.c        |  6 ++++--
 refspec.h        |  6 ++++--
 remote.c         | 12 +++++++-----
 transport.c      |  2 +-
 8 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/branch.c b/branch.c
index df5d24fec6..e1585b10c2 100644
--- a/branch.c
+++ b/branch.c
@@ -38,7 +38,7 @@ static int find_tracked_branch(struct remote *remote, void *priv)
 	if (!remote_find_tracking(remote, &tracking->spec)) {
 		switch (++tracking->matches) {
 		case 1:
-			string_list_append_nodup(tracking->srcs, tracking->spec.src);
+			string_list_append_nodup(tracking->srcs, tracking->spec.src_storage);
 			tracking->remote = remote->name;
 			break;
 		case 2:
@@ -47,7 +47,7 @@ static int find_tracked_branch(struct remote *remote, void *priv)
 			/* fall through */
 		default:
 			string_list_append(&ftb->ambiguous_remotes, remote->name);
-			free(tracking->spec.src);
+			free(tracking->spec.src_storage);
 			string_list_clear(tracking->srcs, 0);
 		break;
 		}
@@ -489,7 +489,7 @@ static int check_tracking_branch(struct remote *remote, void *cb_data)
 	memset(&query, 0, sizeof(struct refspec_item));
 	query.dst = tracking_branch;
 	res = !remote_find_tracking(remote, &query);
-	free(query.src);
+	free(query.src_storage);
 	return res;
 }
 
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 06b60867f5..00a67c99ef 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -443,7 +443,7 @@ static void filter_prefetch_refspec(struct refspec *rs)
 
 	for (i = 0; i < rs->nr; i++) {
 		struct strbuf new_dst = STRBUF_INIT;
-		char *old_dst;
+		const char *old_dst;
 		const char *sub = NULL;
 
 		if (rs->items[i].negative)
@@ -454,8 +454,8 @@ static void filter_prefetch_refspec(struct refspec *rs)
 				 ref_namespace[NAMESPACE_TAGS].ref))) {
 			int j;
 
-			free(rs->items[i].src);
-			free(rs->items[i].dst);
+			free(rs->items[i].src_storage);
+			free(rs->items[i].dst_storage);
 
 			for (j = i + 1; j < rs->nr; j++) {
 				rs->items[j - 1] = rs->items[j];
@@ -481,7 +481,7 @@ static void filter_prefetch_refspec(struct refspec *rs)
 		rs->items[i].dst = strbuf_detach(&new_dst, NULL);
 		rs->items[i].force = 1;
 
-		free(old_dst);
+		free(rs->items[i].dst_storage);
 	}
 }
 
diff --git a/builtin/remote.c b/builtin/remote.c
index b44f580b8c..87b97f5ef1 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -496,8 +496,8 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
 	struct refspec_item refspec = {
 		.force = 0,
 		.pattern = 1,
-		.src = (char *) "refs/heads/*",
-		.dst = (char *) "refs/heads/*",
+		.src = "refs/heads/*",
+		.dst = "refs/heads/*",
 	};
 
 	get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
@@ -981,7 +981,7 @@ static int append_ref_to_tracked_list(const char *refname,
 		return 0;
 
 	memset(&refspec, 0, sizeof(refspec));
-	refspec.dst = (char *)refname;
+	refspec.dst = refname;
 	if (!remote_find_tracking(states->remote, &refspec))
 		string_list_append(&states->tracked, abbrev_branch(refspec.src));
 
diff --git a/checkout.c b/checkout.c
index cfaea4bd10..327ab5f6e3 100644
--- a/checkout.c
+++ b/checkout.c
@@ -8,7 +8,7 @@
 #include "strbuf.h"
 
 struct tracking_name_data {
-	/* const */ char *src_ref;
+	const char *src_ref;
 	char *dst_ref;
 	struct object_id *dst_oid;
 	int num_matches;
@@ -27,7 +27,7 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
 	query.src = cb->src_ref;
 	if (remote_find_tracking(remote, &query) ||
 	    repo_get_oid(the_repository, query.dst, cb->dst_oid)) {
-		free(query.dst);
+		free(query.dst_storage);
 		return 0;
 	}
 	cb->num_matches++;
@@ -38,10 +38,10 @@ static int check_tracking_name(struct remote *remote, void *cb_data)
 		cb->default_dst_oid = dst;
 	}
 	if (cb->dst_ref) {
-		free(query.dst);
+		free(query.dst_storage);
 		return 0;
 	}
-	cb->dst_ref = query.dst;
+	cb->dst_ref = query.dst_storage;
 	return 0;
 }
 
@@ -50,14 +50,15 @@ char *unique_tracking_name(const char *name, struct object_id *oid,
 {
 	struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
 	const char *default_remote = NULL;
+	char *src_ref;
 	if (!git_config_get_string_tmp("checkout.defaultremote", &default_remote))
 		cb_data.default_remote = default_remote;
-	cb_data.src_ref = xstrfmt("refs/heads/%s", name);
+	cb_data.src_ref = src_ref = xstrfmt("refs/heads/%s", name);
 	cb_data.dst_oid = oid;
 	for_each_remote(check_tracking_name, &cb_data);
 	if (dwim_remotes_matched)
 		*dwim_remotes_matched = cb_data.num_matches;
-	free(cb_data.src_ref);
+	free(src_ref);
 	if (cb_data.num_matches == 1) {
 		free(cb_data.default_dst_ref);
 		free(cb_data.default_dst_oid);
diff --git a/refspec.c b/refspec.c
index 1df5de6c2f..a7473c9628 100644
--- a/refspec.c
+++ b/refspec.c
@@ -163,8 +163,10 @@ void refspec_item_init_or_die(struct refspec_item *item, const char *refspec,
 
 void refspec_item_clear(struct refspec_item *item)
 {
-	FREE_AND_NULL(item->src);
-	FREE_AND_NULL(item->dst);
+	FREE_AND_NULL(item->src_storage);
+	item->src = NULL;
+	FREE_AND_NULL(item->dst_storage);
+	item->dst = NULL;
 	item->force = 0;
 	item->pattern = 0;
 	item->matching = 0;
diff --git a/refspec.h b/refspec.h
index 754be45cee..fbc4352397 100644
--- a/refspec.h
+++ b/refspec.h
@@ -24,8 +24,10 @@ struct refspec_item {
 	unsigned exact_sha1 : 1;
 	unsigned negative : 1;
 
-	char *src;
-	char *dst;
+	const char *src;
+	const char *dst;
+	char *src_storage;
+	char *dst_storage;
 };
 
 #define REFSPEC_FETCH 1
diff --git a/remote.c b/remote.c
index d319f28757..d1511ecf83 100644
--- a/remote.c
+++ b/remote.c
@@ -967,7 +967,7 @@ static void query_refspecs_multiple(struct refspec *rs,
 		const char *key = find_src ? refspec->dst : refspec->src;
 		const char *value = find_src ? refspec->src : refspec->dst;
 		const char *needle = find_src ? query->dst : query->src;
-		char **result = find_src ? &query->src : &query->dst;
+		char **result = find_src ? &query->src_storage : &query->dst_storage;
 
 		if (!refspec->dst || refspec->negative)
 			continue;
@@ -985,7 +985,8 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
 	int i;
 	int find_src = !query->src;
 	const char *needle = find_src ? query->dst : query->src;
-	char **result = find_src ? &query->src : &query->dst;
+	char **result = find_src ? &query->src_storage : &query->dst_storage;
+	const char **result_const = find_src ? &query->src : &query->dst;
 
 	if (find_src && !query->dst)
 		BUG("query_refspecs: need either src or dst");
@@ -1002,11 +1003,12 @@ int query_refspecs(struct refspec *rs, struct refspec_item *query)
 			continue;
 		if (refspec->pattern) {
 			if (match_name_with_pattern(key, needle, value, result)) {
+				*result_const = *result;
 				query->force = refspec->force;
 				return 0;
 			}
 		} else if (!strcmp(needle, key)) {
-			*result = xstrdup(value);
+			*result_const = *result = xstrdup(value);
 			query->force = refspec->force;
 			return 0;
 		}
@@ -1019,12 +1021,12 @@ char *apply_refspecs(struct refspec *rs, const char *name)
 	struct refspec_item query;
 
 	memset(&query, 0, sizeof(struct refspec_item));
-	query.src = (char *)name;
+	query.src = name;
 
 	if (query_refspecs(rs, &query))
 		return NULL;
 
-	return query.dst;
+	return query.dst_storage;
 }
 
 int remote_find_tracking(struct remote *remote, struct refspec_item *refspec)
diff --git a/transport.c b/transport.c
index 83ddea8fbc..0cedda425c 100644
--- a/transport.c
+++ b/transport.c
@@ -550,7 +550,7 @@ static void update_one_tracking_ref(struct remote *remote, char *refname,
 			refs_update_ref(get_main_ref_store(the_repository),
 					"update by push", rs.dst, new_oid,
 					NULL, 0, 0);
-		free(rs.dst);
+		free(rs.dst_storage);
 	}
 }
 
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 15 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.