Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-18 23:31:56 +0300
committerJunio C Hamano <gitster@pobox.com>2022-07-18 23:31:57 +0300
commit7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf (patch)
tree5f4b1b70e19b990092cecc676422042ad12e642a /builtin
parent6d003858e5cb82a4ac1892fa6c02604b0aa27fba (diff)
parent06f5f8940c0335f2a5b0a7bbd086115f4659eaa8 (diff)
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 'builtin')
-rw-r--r--builtin/fetch.c3
-rw-r--r--builtin/merge.c4
-rw-r--r--builtin/repack.c2
3 files changed, 1 insertions, 8 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index b019004c1b..fc5cecb483 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1109,7 +1109,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
struct fetch_head *fetch_head)
{
int url_len, i, rc = 0;
- struct strbuf note = STRBUF_INIT, err = STRBUF_INIT;
+ struct strbuf note = STRBUF_INIT;
const char *what, *kind;
struct ref *rm;
char *url;
@@ -1276,7 +1276,6 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
abort:
strbuf_release(&note);
- strbuf_release(&err);
free(url);
return rc;
}
diff --git a/builtin/merge.c b/builtin/merge.c
index d9784d4891..23170f2d2a 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -375,7 +375,6 @@ static void reset_hard(const struct object_id *oid, int verbose)
static void restore_state(const struct object_id *head,
const struct object_id *stash)
{
- struct strbuf sb = STRBUF_INIT;
const char *args[] = { "stash", "apply", NULL, NULL };
if (is_null_oid(stash))
@@ -391,7 +390,6 @@ static void restore_state(const struct object_id *head,
*/
run_command_v_opt(args, RUN_GIT_CMD);
- strbuf_release(&sb);
refresh_cache(REFRESH_QUIET);
}
@@ -502,7 +500,6 @@ static void merge_name(const char *remote, struct strbuf *msg)
{
struct commit *remote_head;
struct object_id branch_head;
- struct strbuf buf = STRBUF_INIT;
struct strbuf bname = STRBUF_INIT;
struct merge_remote_desc *desc;
const char *ptr;
@@ -590,7 +587,6 @@ static void merge_name(const char *remote, struct strbuf *msg)
oid_to_hex(&remote_head->object.oid), remote);
cleanup:
free(found_ref);
- strbuf_release(&buf);
strbuf_release(&bname);
}
diff --git a/builtin/repack.c b/builtin/repack.c
index 4a7ae4cf48..482b66f57d 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -727,7 +727,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
struct child_process cmd = CHILD_PROCESS_INIT;
struct string_list_item *item;
struct string_list names = STRING_LIST_INIT_DUP;
- struct string_list rollback = STRING_LIST_INIT_NODUP;
struct string_list existing_nonkept_packs = STRING_LIST_INIT_DUP;
struct string_list existing_kept_packs = STRING_LIST_INIT_DUP;
struct pack_geometry *geometry = NULL;
@@ -1117,7 +1116,6 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
}
string_list_clear(&names, 0);
- string_list_clear(&rollback, 0);
string_list_clear(&existing_nonkept_packs, 0);
string_list_clear(&existing_kept_packs, 0);
clear_pack_geometry(geometry);