git-compat-util: move alloc macros to git-compat-util.h

alloc_nr, ALLOC_GROW, and ALLOC_GROW_BY are commonly used macros for dynamic array allocation. Moving these macros to git-compat-util.h with the other alloc macros focuses alloc.[ch] to allocation for Git objects and additionally allows us to remove inclusions to alloc.h from files that solely used the above macros. Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Calvin Wan committed Jul 5, 2023 at 17:09 UTC 91c080dff511b7a81f91d1cc79589b49e16a2b7a
88 files changed +75 -161
add-patch.c
-1
@@ -1,7 +1,6 @@
1 #include "git-compat-util.h"
2 #include "add-interactive.h"
3 #include "advice.h"
4 -#include "alloc.h"
4 #include "editor.h"
5 #include "environment.h"
6 #include "gettext.h"
alias.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "alias.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "gettext.h"
5 #include "strbuf.h"
alloc.h
-75
@@ -17,79 +17,4 @@ void *alloc_object_node(struct repository *r);
17 struct alloc_state *allocate_alloc_state(void);
18 void clear_alloc_state(struct alloc_state *s);
19
20 -#define alloc_nr(x) (((x)+16)*3/2)
21 -
22 -/**
23 - * Dynamically growing an array using realloc() is error prone and boring.
24 - *
25 - * Define your array with:
26 - *
27 - * - a pointer (`item`) that points at the array, initialized to `NULL`
28 - * (although please name the variable based on its contents, not on its
29 - * type);
30 - *
31 - * - an integer variable (`alloc`) that keeps track of how big the current
32 - * allocation is, initialized to `0`;
33 - *
34 - * - another integer variable (`nr`) to keep track of how many elements the
35 - * array currently has, initialized to `0`.
36 - *
37 - * Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
38 - * alloc)`. This ensures that the array can hold at least `n` elements by
39 - * calling `realloc(3)` and adjusting `alloc` variable.
40 - *
41 - * ------------
42 - * sometype *item;
43 - * size_t nr;
44 - * size_t alloc
45 - *
46 - * for (i = 0; i < nr; i++)
47 - * if (we like item[i] already)
48 - * return;
49 - *
50 - * // we did not like any existing one, so add one
51 - * ALLOC_GROW(item, nr + 1, alloc);
52 - * item[nr++] = value you like;
53 - * ------------
54 - *
55 - * You are responsible for updating the `nr` variable.
56 - *
57 - * If you need to specify the number of elements to allocate explicitly
58 - * then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
59 - *
60 - * Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
61 - * added niceties.
62 - *
63 - * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
64 - */
65 -#define ALLOC_GROW(x, nr, alloc) \
66 - do { \
67 - if ((nr) > alloc) { \
68 - if (alloc_nr(alloc) < (nr)) \
69 - alloc = (nr); \
70 - else \
71 - alloc = alloc_nr(alloc); \
72 - REALLOC_ARRAY(x, alloc); \
73 - } \
74 - } while (0)
75 -
76 -/*
77 - * Similar to ALLOC_GROW but handles updating of the nr value and
78 - * zeroing the bytes of the newly-grown array elements.
79 - *
80 - * DO NOT USE any expression with side-effect for any of the
81 - * arguments.
82 - */
83 -#define ALLOC_GROW_BY(x, nr, increase, alloc) \
84 - do { \
85 - if (increase) { \
86 - size_t new_nr = nr + (increase); \
87 - if (new_nr < nr) \
88 - BUG("negative growth in ALLOC_GROW_BY"); \
89 - ALLOC_GROW(x, new_nr, alloc); \
90 - memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
91 - nr = new_nr; \
92 - } \
93 - } while (0)
94 -
20 #endif
apply.c
-1
@@ -9,7 +9,6 @@
9
10 #include "git-compat-util.h"
11 #include "abspath.h"
12 -#include "alloc.h"
12 #include "base85.h"
13 #include "config.h"
14 #include "object-store-ll.h"
archive-tar.c
-1
@@ -2,7 +2,6 @@
2 * Copyright (c) 2005, 2006 Rene Scharfe
3 */
4 #include "git-compat-util.h"
5 -#include "alloc.h"
5 #include "config.h"
6 #include "gettext.h"
7 #include "git-zlib.h"
archive.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "convert.h"
5 #include "environment.h"
attr.c
-1
@@ -7,7 +7,6 @@
7 */
8
9 #include "git-compat-util.h"
10 -#include "alloc.h"
10 #include "config.h"
11 #include "environment.h"
12 #include "exec-cmd.h"
builtin/blame.c
-1
@@ -6,7 +6,6 @@
6 */
7
8 #include "git-compat-util.h"
9 -#include "alloc.h"
9 #include "config.h"
10 #include "color.h"
11 #include "builtin.h"
builtin/cat-file.c
-1
@@ -5,7 +5,6 @@
5 */
6 #define USE_THE_INDEX_VARIABLE
7 #include "builtin.h"
8 -#include "alloc.h"
8 #include "config.h"
9 #include "convert.h"
10 #include "diff.h"
builtin/checkout--worker.c
-1
@@ -1,5 +1,4 @@
1 #include "builtin.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "entry.h"
4 #include "gettext.h"
builtin/config.c
-1
@@ -1,6 +1,5 @@
1 #include "builtin.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "color.h"
5 #include "editor.h"
builtin/credential-cache--daemon.c
-1
@@ -1,6 +1,5 @@
1 #include "builtin.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "gettext.h"
4 #include "object-file.h"
5 #include "parse-options.h"
builtin/fetch-pack.c
-1
@@ -1,5 +1,4 @@
1 #include "builtin.h"
2 -#include "alloc.h"
2 #include "gettext.h"
3 #include "hex.h"
4 #include "object-file.h"
builtin/fsmonitor--daemon.c
-1
@@ -1,6 +1,5 @@
1 #include "builtin.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "environment.h"
5 #include "gettext.h"
builtin/grep.c
-1
@@ -4,7 +4,6 @@
4 * Copyright (c) 2006 Junio C Hamano
5 */
6 #include "builtin.h"
7 -#include "alloc.h"
7 #include "gettext.h"
8 #include "hex.h"
9 #include "repository.h"
builtin/index-pack.c
-1
@@ -1,5 +1,4 @@
1 #include "builtin.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "delta.h"
4 #include "environment.h"
builtin/log.c
-1
@@ -6,7 +6,6 @@
6 */
7 #include "git-compat-util.h"
8 #include "abspath.h"
9 -#include "alloc.h"
9 #include "config.h"
10 #include "environment.h"
11 #include "gettext.h"
builtin/merge.c
-1
@@ -10,7 +10,6 @@
10 #include "builtin.h"
11 #include "abspath.h"
12 #include "advice.h"
13 -#include "alloc.h"
13 #include "config.h"
14 #include "editor.h"
15 #include "environment.h"
builtin/mktree.c
-1
@@ -4,7 +4,6 @@
4 * Copyright (c) Junio C Hamano, 2006, 2009
5 */
6 #include "builtin.h"
7 -#include "alloc.h"
7 #include "gettext.h"
8 #include "hex.h"
9 #include "quote.h"
builtin/mv.c
-1
@@ -7,7 +7,6 @@
7 #include "builtin.h"
8 #include "abspath.h"
9 #include "advice.h"
10 -#include "alloc.h"
10 #include "config.h"
11 #include "environment.h"
12 #include "gettext.h"
builtin/name-rev.c
-1
@@ -1,5 +1,4 @@
1 #include "builtin.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "gettext.h"
4 #include "hex.h"
builtin/pack-objects.c
-1
@@ -1,5 +1,4 @@
1 #include "builtin.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "gettext.h"
4 #include "hex.h"
builtin/repack.c
-1
@@ -1,5 +1,4 @@
1 #include "builtin.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "dir.h"
4 #include "environment.h"
builtin/rev-parse.c
-1
@@ -6,7 +6,6 @@
6 #define USE_THE_INDEX_VARIABLE
7 #include "builtin.h"
8 #include "abspath.h"
9 -#include "alloc.h"
9 #include "config.h"
10 #include "commit.h"
11 #include "environment.h"
builtin/revert.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "builtin.h"
4 #include "parse-options.h"
builtin/rm.c
-1
@@ -5,7 +5,6 @@
5 */
6 #define USE_THE_INDEX_VARIABLE
7 #include "builtin.h"
8 -#include "alloc.h"
8 #include "advice.h"
9 #include "config.h"
10 #include "lockfile.h"
builtin/submodule--helper.c
-1
@@ -1,7 +1,6 @@
1 #define USE_THE_INDEX_VARIABLE
2 #include "builtin.h"
3 #include "abspath.h"
4 -#include "alloc.h"
4 #include "environment.h"
5 #include "gettext.h"
6 #include "hex.h"
bulk-checkin.c
-1
@@ -2,7 +2,6 @@
2 * Copyright (c) 2011, Google Inc.
3 */
4 #include "git-compat-util.h"
5 -#include "alloc.h"
5 #include "bulk-checkin.h"
6 #include "environment.h"
7 #include "gettext.h"
cache-tree.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "hex.h"
4 #include "lockfile.h"
chunk-format.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "chunk-format.h"
3 #include "csum-file.h"
4 #include "gettext.h"
commit-reach.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "commit.h"
3 #include "commit-graph.h"
4 #include "decorate.h"
config.c
-1
@@ -8,7 +8,6 @@
8 #include "git-compat-util.h"
9 #include "abspath.h"
10 #include "advice.h"
11 -#include "alloc.h"
11 #include "date.h"
12 #include "branch.h"
13 #include "config.h"
daemon.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "environment.h"
5 #include "path.h"
delta-islands.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "attr.h"
3 #include "object.h"
4 #include "blob.h"
diff.c
-1
@@ -3,7 +3,6 @@
3 */
4 #include "git-compat-util.h"
5 #include "abspath.h"
6 -#include "alloc.h"
6 #include "base85.h"
7 #include "config.h"
8 #include "convert.h"
diffcore-rename.c
-1
@@ -3,7 +3,6 @@
3 * Copyright (C) 2005 Junio C Hamano
4 */
5 #include "git-compat-util.h"
6 -#include "alloc.h"
6 #include "diff.h"
7 #include "diffcore.h"
8 #include "object-store-ll.h"
dir-iterator.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "dir.h"
3 #include "iterator.h"
4 #include "dir-iterator.h"
dir.c
-1
@@ -7,7 +7,6 @@
7 */
8 #include "git-compat-util.h"
9 #include "abspath.h"
10 -#include "alloc.h"
10 #include "config.h"
11 #include "convert.h"
12 #include "dir.h"
ewah/bitmap.c
-1
@@ -17,7 +17,6 @@
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19 #include "git-compat-util.h"
20 -#include "alloc.h"
20 #include "ewok.h"
21
22 #define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_EWORD))
ewah/ewah_bitmap.c
-1
@@ -17,7 +17,6 @@
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 */
19 #include "git-compat-util.h"
20 -#include "alloc.h"
20 #include "ewok.h"
21 #include "ewok_rlw.h"
22
fetch-pack.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "repository.h"
3 #include "config.h"
4 #include "date.h"
fmt-merge-msg.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "environment.h"
4 #include "refs.h"
fsck.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "date.h"
3 #include "dir.h"
4 #include "hex.h"
git-compat-util.h
+75
@@ -1134,6 +1134,81 @@ static inline void move_array(void *dst, const void *src, size_t n, size_t size)
1134 #define FLEXPTR_ALLOC_STR(x, ptrname, str) \
1135 FLEXPTR_ALLOC_MEM((x), ptrname, (str), strlen(str))
1136
1137 +#define alloc_nr(x) (((x)+16)*3/2)
1138 +
1139 +/**
1140 + * Dynamically growing an array using realloc() is error prone and boring.
1141 + *
1142 + * Define your array with:
1143 + *
1144 + * - a pointer (`item`) that points at the array, initialized to `NULL`
1145 + * (although please name the variable based on its contents, not on its
1146 + * type);
1147 + *
1148 + * - an integer variable (`alloc`) that keeps track of how big the current
1149 + * allocation is, initialized to `0`;
1150 + *
1151 + * - another integer variable (`nr`) to keep track of how many elements the
1152 + * array currently has, initialized to `0`.
1153 + *
1154 + * Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
1155 + * alloc)`. This ensures that the array can hold at least `n` elements by
1156 + * calling `realloc(3)` and adjusting `alloc` variable.
1157 + *
1158 + * ------------
1159 + * sometype *item;
1160 + * size_t nr;
1161 + * size_t alloc
1162 + *
1163 + * for (i = 0; i < nr; i++)
1164 + * if (we like item[i] already)
1165 + * return;
1166 + *
1167 + * // we did not like any existing one, so add one
1168 + * ALLOC_GROW(item, nr + 1, alloc);
1169 + * item[nr++] = value you like;
1170 + * ------------
1171 + *
1172 + * You are responsible for updating the `nr` variable.
1173 + *
1174 + * If you need to specify the number of elements to allocate explicitly
1175 + * then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
1176 + *
1177 + * Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
1178 + * added niceties.
1179 + *
1180 + * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
1181 + */
1182 +#define ALLOC_GROW(x, nr, alloc) \
1183 + do { \
1184 + if ((nr) > alloc) { \
1185 + if (alloc_nr(alloc) < (nr)) \
1186 + alloc = (nr); \
1187 + else \
1188 + alloc = alloc_nr(alloc); \
1189 + REALLOC_ARRAY(x, alloc); \
1190 + } \
1191 + } while (0)
1192 +
1193 +/*
1194 + * Similar to ALLOC_GROW but handles updating of the nr value and
1195 + * zeroing the bytes of the newly-grown array elements.
1196 + *
1197 + * DO NOT USE any expression with side-effect for any of the
1198 + * arguments.
1199 + */
1200 +#define ALLOC_GROW_BY(x, nr, increase, alloc) \
1201 + do { \
1202 + if (increase) { \
1203 + size_t new_nr = nr + (increase); \
1204 + if (new_nr < nr) \
1205 + BUG("negative growth in ALLOC_GROW_BY"); \
1206 + ALLOC_GROW(x, new_nr, alloc); \
1207 + memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
1208 + nr = new_nr; \
1209 + } \
1210 + } while (0)
1211 +
1212 static inline char *xstrdup_or_null(const char *str)
1213 {
1214 return str ? xstrdup(str) : NULL;
help.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "builtin.h"
4 #include "exec-cmd.h"
http-backend.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "environment.h"
4 #include "git-zlib.h"
line-log.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "line-range.h"
3 #include "hex.h"
4 #include "tag.h"
list-objects-filter-options.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "commit.h"
3 #include "config.h"
4 #include "gettext.h"
list-objects-filter.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "dir.h"
3 #include "gettext.h"
4 #include "hex.h"
midx.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "csum-file.h"
5 #include "dir.h"
object-file.c
-1
@@ -8,7 +8,6 @@
8 */
9 #include "git-compat-util.h"
10 #include "abspath.h"
11 -#include "alloc.h"
11 #include "config.h"
12 #include "convert.h"
13 #include "environment.h"
oid-array.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "oid-array.h"
3 #include "hash-lookup.h"
4
oidtree.c
-1
@@ -4,7 +4,6 @@
4 */
5 #include "git-compat-util.h"
6 #include "oidtree.h"
7 -#include "alloc.h"
7 #include "hash.h"
8
9 struct oidtree_iter_data {
pack-bitmap-write.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "gettext.h"
4 #include "hex.h"
pack-bitmap.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "commit.h"
3 #include "gettext.h"
4 #include "hex.h"
pack-objects.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "object.h"
3 #include "pack.h"
4 #include "pack-objects.h"
packfile.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "gettext.h"
4 #include "hex.h"
parallel-checkout.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "entry.h"
4 #include "gettext.h"
pretty.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "commit.h"
4 #include "environment.h"
prio-queue.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "prio-queue.h"
3
4 static inline int compare(struct prio_queue *queue, int i, int j)
quote.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "path.h"
3 #include "quote.h"
4 #include "strbuf.h"
read-cache.c
-1
@@ -4,7 +4,6 @@
4 * Copyright (C) Linus Torvalds, 2005
5 */
6 #include "git-compat-util.h"
7 -#include "alloc.h"
7 #include "bulk-checkin.h"
8 #include "config.h"
9 #include "date.h"
ref-filter.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "gettext.h"
4 #include "gpg-interface.h"
reflog-walk.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "commit.h"
3 #include "refs.h"
4 #include "diff.h"
refs.c
-1
@@ -4,7 +4,6 @@
4
5 #include "git-compat-util.h"
6 #include "advice.h"
7 -#include "alloc.h"
7 #include "config.h"
8 #include "environment.h"
9 #include "hashmap.h"
refspec.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "gettext.h"
3 #include "hash.h"
4 #include "hex.h"
remote-curl.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "environment.h"
4 #include "gettext.h"
remote.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "environment.h"
5 #include "gettext.h"
rerere.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "copy.h"
5 #include "gettext.h"
revision.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "environment.h"
4 #include "gettext.h"
sequencer.c
-1
@@ -1,7 +1,6 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 #include "advice.h"
4 -#include "alloc.h"
4 #include "config.h"
5 #include "copy.h"
6 #include "environment.h"
server-info.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "dir.h"
3 #include "environment.h"
4 #include "hex.h"
shallow.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "hex.h"
3 #include "repository.h"
4 #include "tempfile.h"
sigchain.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "sigchain.h"
3
4 #define SIGCHAIN_MAX_SIGNALS 32
sparse-index.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "environment.h"
3 #include "gettext.h"
4 #include "name-hash.h"
split-index.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "gettext.h"
3 #include "hash.h"
4 #include "mem-pool.h"
strbuf.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "environment.h"
4 #include "gettext.h"
5 #include "hex.h"
string-list.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "string-list.h"
3 -#include "alloc.h"
3
4 void string_list_init_nodup(struct string_list *list)
5 {
strvec.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "strvec.h"
3 -#include "alloc.h"
3 #include "hex.h"
4 #include "strbuf.h"
5
submodule-config.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "dir.h"
3 #include "environment.h"
4 #include "gettext.h"
submodule.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "repository.h"
4 #include "config.h"
5 #include "submodule-config.h"
t/helper/test-reach.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "alloc.h"
2 #include "commit.h"
3 #include "commit-reach.h"
4 #include "config.h"
trace2/tr2_tls.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "thread-utils.h"
3 #include "trace.h"
4 #include "trace2/tr2_tls.h"
trailer.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "environment.h"
4 #include "gettext.h"
transport.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "advice.h"
3 -#include "alloc.h"
3 #include "config.h"
4 #include "environment.h"
5 #include "hex.h"
tree-walk.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "tree-walk.h"
3 -#include "alloc.h"
3 #include "dir.h"
4 #include "gettext.h"
5 #include "hex.h"
userdiff.c
-1
@@ -1,5 +1,4 @@
1 #include "git-compat-util.h"
2 -#include "alloc.h"
2 #include "config.h"
3 #include "userdiff.h"
4 #include "attr.h"
worktree.c
-1
@@ -1,6 +1,5 @@
1 #include "git-compat-util.h"
2 #include "abspath.h"
3 -#include "alloc.h"
3 #include "environment.h"
4 #include "gettext.h"
5 #include "path.h"