Skip to content

Commit 76e50f7

Browse files
peffgitster
authored andcommitted
fast-export: drop const when storing anonymized values
We store anonymized values as pointers to "const char *", since they are conceptually const to callers who use them. But they are actually allocated strings whose memory is owned by the struct. The ownership mismatch hasn't been a big deal since we never free() them (they are held until the program ends), but let's switch them to "char *" in preparation for changing that. Since most code only accesses them via anonymize_str(), it can continue to narrow them to "const char *" in its return value. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27d43aa commit 76e50f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static struct decoration idnums;
110110
static uint32_t last_idnum;
111111
struct anonymized_entry {
112112
struct hashmap_entry hash;
113-
const char *anon;
113+
char *anon;
114114
const char orig[FLEX_ARRAY];
115115
};
116116

0 commit comments

Comments
 (0)