aboutsummaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-07 08:37:39 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-07 10:30:48 -0700
commitb567004b4b43f9b0d88aa1f0b15698eae8f15836 (patch)
treefc7b75831c1eb79a89c0196fbb78bd6b7d09d0b1 /diff.c
parentMerge branch 'ps/leakfixes' into ps/no-writable-strings (diff)
downloadgit-b567004b4b43f9b0d88aa1f0b15698eae8f15836.tar.gz
git-b567004b4b43f9b0d88aa1f0b15698eae8f15836.zip
global: improve const correctness when assigning string constants
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c4
1 files changed, 2 insertions, 2 deletions
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)