{"thread":{"id":"65189","subject":"[PATCH] convert: constify some variables in ident_to_worktree()","startedAt":"2026-03-10T04:04:06Z","lastAt":"2026-03-10T04:04:06Z","messageCount":1,"participants":["Collin Funk"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"538353","messageId":"d3447c19d83c37bf2db84ae0bf75801ef7a36cea.1773115420.git.collin.funk1@gmail.com","threadId":"65189","inReplyTo":null,"subject":"[PATCH] convert: constify some variables in ident_to_worktree()","fromName":"Collin Funk","fromEmail":"collin.funk1@gmail.com","sentAt":"2026-03-10T04:03:40Z","receivedAt":"2026-03-10T04:04:06Z","isPatch":true,"sender":{"key":"collin.funk1@gmail.com","avatar":"https://avatars.githubusercontent.com/u/65689063?v=4"},"body":"When building with glibc-2.43 there is the following warnings:\n\n    convert.c: In function ‘ident_to_worktree’:\n    convert.c:1189:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]\n     1189 |                 dollar = memchr(src, '$', len);\n          |                        ^\n    convert.c:1212:32: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]\n     1212 |                         dollar = memchr(src + 3, '$', len - 3);\n          |                                ^\n    convert.c:1223:29: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]\n     1223 |                         spc = memchr(src + 4, ' ', dollar - src - 4);\n          |                             ^\n\nThe \"dollar\" and \"space\" pointers are used to iterate over the const\nstring \"src\". Since they are never written to we can make them const\ntoo.\n\nSigned-off-by: Collin Funk <collin.funk1@gmail.com>\n---\n convert.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/convert.c b/convert.c\nindex a34ec6ecdc..eae36c8a59 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1168,7 +1168,8 @@ static int ident_to_worktree(const char *src, size_t len,\n \t\t\t     struct strbuf *buf, int ident)\n {\n \tstruct object_id oid;\n-\tchar *to_free = NULL, *dollar, *spc;\n+\tchar *to_free = NULL;\n+\tconst char *dollar, *spc;\n \tint cnt;\n \n \tif (!ident)\n-- \n2.53.0\n\n"}]}