aboutsummaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-18 13:31:56 -0700
committerJunio C Hamano <gitster@pobox.com>2022-07-18 13:31:57 -0700
commit7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf (patch)
tree5f4b1b70e19b990092cecc676422042ad12e642a /diff.c
parent6d003858e5cb82a4ac1892fa6c02604b0aa27fba (diff)
parent06f5f8940c0335f2a5b0a7bbd086115f4659eaa8 (diff)
downloadgit-7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf.tar.gz
Merge branch 'ab/cocci-unused'
Add Coccinelle rules to detect the pattern of initializing and then finalizing a structure without using it in between at all, which happens after code restructuring and the compilers fail to recognize as an unused variable. * ab/cocci-unused: cocci: generalize "unused" rule to cover more than "strbuf" cocci: add and apply a rule to find "unused" strbufs cocci: have "coccicheck{,-pending}" depend on "coccicheck-test" cocci: add a "coccicheck-test" target and test *.cocci rules Makefile & .gitignore: ignore & clean "git.res", not "*.res" Makefile: remove mandatory "spatch" arguments from SPATCH_FLAGS
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index 2214ae49e4..974626a621 100644
--- a/diff.c
+++ b/diff.c
@@ -1289,7 +1289,6 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
{
static const char *nneof = " No newline at end of file\n";
const char *context, *reset, *set, *set_sign, *meta, *fraginfo;
- struct strbuf sb = STRBUF_INIT;
enum diff_symbol s = eds->s;
const char *line = eds->line;
@@ -1521,7 +1520,6 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
default:
BUG("unknown diff symbol");
}
- strbuf_release(&sb);
}
static void emit_diff_symbol(struct diff_options *o, enum diff_symbol s,