From 551f5022019803cceb0fa3943f696fae32f093f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 31 Mar 2022 03:45:50 +0200 Subject: [PATCH 1/6] run-command.h: remove always unused "clean_on_exit_handler_cbdata" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove a "struct child_process" member added in ac2fbaa674c (run-command: add clean_on_exit_handler, 2016-10-16), but which was never used. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- run-command.h | 1 - 1 file changed, 1 deletion(-) diff --git a/run-command.h b/run-command.h index 07bed6c31b4..5bd0c933e80 100644 --- a/run-command.h +++ b/run-command.h @@ -142,7 +142,6 @@ struct child_process { unsigned clean_on_exit:1; unsigned wait_after_clean:1; void (*clean_on_exit_handler)(struct child_process *process); - void *clean_on_exit_handler_cbdata; }; #define CHILD_PROCESS_INIT { \ From 7146f271c6077ff35e33684b8e7de48dca4e9dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 31 Mar 2022 03:45:51 +0200 Subject: [PATCH 2/6] configure.ac: remove USE_PIC comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove a comment about a Makefile knob that was removed in f7661ce0b8e (Remove -fPIC which was only needed for Git.xs, 2006-09-29). The comment had been copied over to configure.ac in 633b423961d (Copy description of build configuration variables to configure.ac, 2006-07-08). Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index 6bd6bef1c44..789dcde3eae 100644 --- a/configure.ac +++ b/configure.ac @@ -1189,9 +1189,6 @@ AC_COMPILE_IFELSE([BSD_SYSCTL_SRC], GIT_CONF_SUBST([HAVE_BSD_SYSCTL]) ## Other checks. -# Define USE_PIC if you need the main git objects to be built with -fPIC -# in order to build and link perl/Git.so. x86-64 seems to need this. -# # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. # Enable it on Windows. By default, symrefs are still used. # From 8c0cfadd9a8afd1accd05e5a31e044620726bcc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 31 Mar 2022 03:45:52 +0200 Subject: [PATCH 3/6] xdiff/xmacros.h: remove unused XDL_PTRFREE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This macro was added in 3443546f6ef (Use a *real* built-in diff generator, 2006-03-24), but none of the xdiff code uses it, it uses xdl_free() directly. If we need its functionality again we'll use the FREE_AND_NULL() macro added in 481df65f4f7 (git-compat-util: add a FREE_AND_NULL() wrapper around free(ptr); ptr = NULL, 2017-06-15). Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- xdiff/xmacros.h | 1 - 1 file changed, 1 deletion(-) diff --git a/xdiff/xmacros.h b/xdiff/xmacros.h index 2809a28ca96..ae4636c2477 100644 --- a/xdiff/xmacros.h +++ b/xdiff/xmacros.h @@ -34,7 +34,6 @@ #define XDL_ADDBITS(v,b) ((v) + ((v) >> (b))) #define XDL_MASKBITS(b) ((1UL << (b)) - 1) #define XDL_HASHLONG(v,b) (XDL_ADDBITS((unsigned long)(v), b) & XDL_MASKBITS(b)) -#define XDL_PTRFREE(p) do { if (p) { xdl_free(p); (p) = NULL; } } while (0) #define XDL_LE32_PUT(p, v) \ do { \ unsigned char *__p = (unsigned char *) (p); \ From b676b73232fab679502f7c77e60f0852b4f2a09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 31 Mar 2022 03:45:53 +0200 Subject: [PATCH 4/6] pack-bitmap-write: remove unused bitmap_reset() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function hasn't been used since 449fa5ee069 (pack-bitmap-write: ignore BITMAP_FLAG_REUSE, 2020-12-08), which was a cleanup commit intending to get rid of the code around the reusing of bitmaps. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- ewah/bitmap.c | 5 ----- ewah/ewok.h | 1 - 2 files changed, 6 deletions(-) diff --git a/ewah/bitmap.c b/ewah/bitmap.c index 38a47c44db4..87d5cc8fa30 100644 --- a/ewah/bitmap.c +++ b/ewah/bitmap.c @@ -216,11 +216,6 @@ int bitmap_is_subset(struct bitmap *self, struct bitmap *other) return 0; } -void bitmap_reset(struct bitmap *bitmap) -{ - memset(bitmap->words, 0x0, bitmap->word_alloc * sizeof(eword_t)); -} - void bitmap_free(struct bitmap *bitmap) { if (bitmap == NULL) diff --git a/ewah/ewok.h b/ewah/ewok.h index 66920965da1..7eb8b9b6301 100644 --- a/ewah/ewok.h +++ b/ewah/ewok.h @@ -177,7 +177,6 @@ struct bitmap *bitmap_dup(const struct bitmap *src); void bitmap_set(struct bitmap *self, size_t pos); void bitmap_unset(struct bitmap *self, size_t pos); int bitmap_get(struct bitmap *self, size_t pos); -void bitmap_reset(struct bitmap *self); void bitmap_free(struct bitmap *self); int bitmap_equals(struct bitmap *self, struct bitmap *other); int bitmap_is_subset(struct bitmap *self, struct bitmap *other); From 89ef49b30c09a0a8c96a59bbbb38065f89319af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 31 Mar 2022 03:45:54 +0200 Subject: [PATCH 5/6] object-store.h: remove unused has_sha1_file*() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These macros were last used in 5d3679ee023 (sha1-file: drop has_sha1_file(), 2019-01-07), so let's remove coccinelle migration rules added 9b45f499818 (object-store: prepare has_{sha1, object}_file to handle any repo, 2018-11-13), along with the compatibility macros themselves. The "These functions.." in the diff context and the general comment about compatibility macros still applies to "NO_THE_REPOSITORY_COMPATIBILITY_MACROS" use just a few lines below this, so let's keep the comment. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- contrib/coccinelle/the_repository.pending.cocci | 15 --------------- object-store.h | 4 ---- 2 files changed, 19 deletions(-) diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci index 2ee702ecf7f..072ea0d9228 100644 --- a/contrib/coccinelle/the_repository.pending.cocci +++ b/contrib/coccinelle/the_repository.pending.cocci @@ -11,21 +11,6 @@ expression G; + repo_read_object_file(the_repository, E, F, G) -@@ -expression E; -@@ -- has_sha1_file( -+ repo_has_sha1_file(the_repository, - E) - -@@ -expression E; -expression F; -@@ -- has_sha1_file_with_flags( -+ repo_has_sha1_file_with_flags(the_repository, - E) - @@ expression E; @@ diff --git a/object-store.h b/object-store.h index bd2322ed8ce..53996018c11 100644 --- a/object-store.h +++ b/object-store.h @@ -312,10 +312,6 @@ int has_object(struct repository *r, const struct object_id *oid, * These functions can be removed once all callers have migrated to * has_object() and/or oid_object_info_extended(). */ -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS -#define has_sha1_file_with_flags(sha1, flags) repo_has_sha1_file_with_flags(the_repository, sha1, flags) -#define has_sha1_file(sha1) repo_has_sha1_file(the_repository, sha1) -#endif int repo_has_object_file(struct repository *r, const struct object_id *oid); int repo_has_object_file_with_flags(struct repository *r, const struct object_id *oid, int flags); From 0b75e5bf22d6c2ad0589990613478277a7a48c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 31 Mar 2022 03:45:55 +0200 Subject: [PATCH 6/6] alloc.[ch]: remove alloc_report() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The alloc_report() function has been orphaned since its introduction in 855419f764a (Add specialized object allocator, 2006-06-19), it appears to have been used for demonstration purposes in that commit message. These might be handy to manually use in a debugger, but keeping them and the "count" member of "alloc_state" just for that doesn't seem worth it. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- alloc.c | 21 --------------------- alloc.h | 1 - 2 files changed, 22 deletions(-) diff --git a/alloc.c b/alloc.c index 957a0af3626..27f697e4c87 100644 --- a/alloc.c +++ b/alloc.c @@ -27,7 +27,6 @@ union any_object { }; struct alloc_state { - int count; /* total number of nodes allocated */ int nr; /* number of nodes left in current allocation */ void *p; /* first free node in current allocation */ @@ -63,7 +62,6 @@ static inline void *alloc_node(struct alloc_state *s, size_t node_size) s->slabs[s->slab_nr++] = s->p; } s->nr--; - s->count++; ret = s->p; s->p = (char *)s->p + node_size; memset(ret, 0, node_size); @@ -122,22 +120,3 @@ void *alloc_commit_node(struct repository *r) init_commit_node(c); return c; } - -static void report(const char *name, unsigned int count, size_t size) -{ - fprintf(stderr, "%10s: %8u (%"PRIuMAX" kB)\n", - name, count, (uintmax_t) size); -} - -#define REPORT(name, type) \ - report(#name, r->parsed_objects->name##_state->count, \ - r->parsed_objects->name##_state->count * sizeof(type) >> 10) - -void alloc_report(struct repository *r) -{ - REPORT(blob, struct blob); - REPORT(tree, struct tree); - REPORT(commit, struct commit); - REPORT(tag, struct tag); - REPORT(object, union any_object); -} diff --git a/alloc.h b/alloc.h index 371d388b552..3f4a0ad310a 100644 --- a/alloc.h +++ b/alloc.h @@ -13,7 +13,6 @@ void init_commit_node(struct commit *c); void *alloc_commit_node(struct repository *r); void *alloc_tag_node(struct repository *r); void *alloc_object_node(struct repository *r); -void alloc_report(struct repository *r); struct alloc_state *allocate_alloc_state(void); void clear_alloc_state(struct alloc_state *s);