]> Kevux Git Server - rit/commitdiff
alloc.h: move ALLOC_GROW() functions from cache.h
authorElijah Newren <newren@gmail.com>
Fri, 24 Feb 2023 00:09:24 +0000 (00:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Feb 2023 01:25:28 +0000 (17:25 -0800)
This allows us to replace includes of cache.h with includes of the much
smaller alloc.h in many places.  It does mean that we also need to add
includes of alloc.h in a number of C files.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
91 files changed:
add-patch.c
alias.c
alloc.h
apply.c
archive-tar.c
archive.c
attr.c
builtin/blame.c
builtin/cat-file.c
builtin/checkout--worker.c
builtin/config.c
builtin/credential-cache--daemon.c
builtin/fetch-pack.c
builtin/fsmonitor--daemon.c
builtin/grep.c
builtin/index-pack.c
builtin/log.c
builtin/merge.c
builtin/mktree.c
builtin/mv.c
builtin/name-rev.c
builtin/pack-objects.c
builtin/repack.c
builtin/rev-parse.c
builtin/revert.c
builtin/rm.c
builtin/submodule--helper.c
bulk-checkin.c
cache-tree.c
cache.h
chunk-format.c
commit-reach.c
compat/mingw.c
config.c
daemon.c
delta-islands.c
diff.c
diffcore-rename.c
dir-iterator.c
dir.c
ewah/bitmap.c
ewah/ewah_bitmap.c
fetch-pack.c
fmt-merge-msg.c
fsck.c
fsmonitor-settings.c
help.c
http-backend.c
line-log.c
list-objects-filter-options.c
list-objects-filter.c
midx.c
object-file.c
oid-array.c
pack-bitmap-write.c
pack-bitmap.c
pack-objects.c
packfile.c
parallel-checkout.c
pretty.c
prio-queue.c
quote.c
read-cache.c
ref-filter.c
reflog-walk.c
refs.c
refs/packed-backend.c
refs/ref-cache.c
refspec.c
remote-curl.c
remote.c
rerere.c
revision.c
sequencer.c
server-info.c
shallow.c
sigchain.c
sparse-index.c
split-index.c
strbuf.c
string-list.c
strvec.c
submodule-config.c
submodule.c
t/helper/test-reach.c
trace2/tr2_tls.c
trailer.c
transport.c
tree-walk.c
userdiff.c
worktree.c

index a86a92e..c6e451c 100644 (file)
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "add-interactive.h"
+#include "alloc.h"
 #include "strbuf.h"
 #include "run-command.h"
 #include "strvec.h"
diff --git a/alias.c b/alias.c
index 00abde0..e814948 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "alias.h"
+#include "alloc.h"
 #include "config.h"
+#include "gettext.h"
 #include "string-list.h"
 
 struct config_alias_data {
diff --git a/alloc.h b/alloc.h
index 3f4a0ad..4312db4 100644 (file)
--- a/alloc.h
+++ b/alloc.h
@@ -17,4 +17,79 @@ void *alloc_object_node(struct repository *r);
 struct alloc_state *allocate_alloc_state(void);
 void clear_alloc_state(struct alloc_state *s);
 
+#define alloc_nr(x) (((x)+16)*3/2)
+
+/**
+ * Dynamically growing an array using realloc() is error prone and boring.
+ *
+ * Define your array with:
+ *
+ * - a pointer (`item`) that points at the array, initialized to `NULL`
+ *   (although please name the variable based on its contents, not on its
+ *   type);
+ *
+ * - an integer variable (`alloc`) that keeps track of how big the current
+ *   allocation is, initialized to `0`;
+ *
+ * - another integer variable (`nr`) to keep track of how many elements the
+ *   array currently has, initialized to `0`.
+ *
+ * Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
+ * alloc)`.  This ensures that the array can hold at least `n` elements by
+ * calling `realloc(3)` and adjusting `alloc` variable.
+ *
+ * ------------
+ * sometype *item;
+ * size_t nr;
+ * size_t alloc
+ *
+ * for (i = 0; i < nr; i++)
+ *     if (we like item[i] already)
+ *             return;
+ *
+ * // we did not like any existing one, so add one
+ * ALLOC_GROW(item, nr + 1, alloc);
+ * item[nr++] = value you like;
+ * ------------
+ *
+ * You are responsible for updating the `nr` variable.
+ *
+ * If you need to specify the number of elements to allocate explicitly
+ * then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
+ *
+ * Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
+ * added niceties.
+ *
+ * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
+ */
+#define ALLOC_GROW(x, nr, alloc) \
+       do { \
+               if ((nr) > alloc) { \
+                       if (alloc_nr(alloc) < (nr)) \
+                               alloc = (nr); \
+                       else \
+                               alloc = alloc_nr(alloc); \
+                       REALLOC_ARRAY(x, alloc); \
+               } \
+       } while (0)
+
+/*
+ * Similar to ALLOC_GROW but handles updating of the nr value and
+ * zeroing the bytes of the newly-grown array elements.
+ *
+ * DO NOT USE any expression with side-effect for any of the
+ * arguments.
+ */
+#define ALLOC_GROW_BY(x, nr, increase, alloc) \
+       do { \
+               if (increase) { \
+                       size_t new_nr = nr + (increase); \
+                       if (new_nr < nr) \
+                               BUG("negative growth in ALLOC_GROW_BY"); \
+                       ALLOC_GROW(x, new_nr, alloc); \
+                       memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
+                       nr = new_nr; \
+               } \
+       } while (0)
+
 #endif
diff --git a/apply.c b/apply.c
index 5cc5479..7f12ebf 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -8,6 +8,7 @@
  */
 
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "object-store.h"
 #include "blob.h"
index f8fad29..9406f03 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Copyright (c) 2005, 2006 Rene Scharfe
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "tar.h"
 #include "archive.h"
index f2a8756..35719e5 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "refs.h"
 #include "object-store.h"
diff --git a/attr.c b/attr.c
index 1053dfc..657ee52 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -7,6 +7,7 @@
  */
 
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "exec-cmd.h"
 #include "attr.h"
index 71f925e..4d1609c 100644 (file)
@@ -5,7 +5,8 @@
  * See COPYING for licensing conditions
  */
 
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "color.h"
 #include "builtin.h"
index cc17635..5b8be7c 100644 (file)
@@ -5,6 +5,7 @@
  */
 #define USE_THE_INDEX_VARIABLE
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "builtin.h"
 #include "diff.h"
index ede7dc3..0a7d762 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "entry.h"
 #include "parallel-checkout.h"
index 060cf9f..ca006e9 100644 (file)
@@ -1,5 +1,5 @@
 #include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "color.h"
 #include "parse-options.h"
index f3c8983..590aefc 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "parse-options.h"
 
 #ifndef NO_UNIX_SOCKETS
index afe6793..113f22c 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "pkt-line.h"
 #include "fetch-pack.h"
 #include "remote.h"
index 0feef8c..cae804a 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "parse-options.h"
 #include "fsmonitor.h"
index f7821c5..a08e584 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2006 Junio C Hamano
  */
 #include "cache.h"
+#include "alloc.h"
 #include "repository.h"
 #include "config.h"
 #include "blob.h"
index 6648f2d..7e4b69f 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "delta.h"
 #include "pack.h"
index 04412dd..8554096 100644 (file)
@@ -4,7 +4,8 @@
  * (C) Copyright 2006 Linus Torvalds
  *              2006 Junio Hamano
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "refs.h"
 #include "object-store.h"
index 0a3c10a..716a23f 100644 (file)
@@ -8,6 +8,7 @@
 
 #define USE_THE_INDEX_VARIABLE
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "parse-options.h"
 #include "builtin.h"
index 06d8140..ec721ff 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) Junio C Hamano, 2006, 2009
  */
 #include "builtin.h"
+#include "alloc.h"
 #include "quote.h"
 #include "tree.h"
 #include "parse-options.h"
index edd7b93..8129050 100644 (file)
@@ -5,6 +5,7 @@
  */
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "pathspec.h"
 #include "lockfile.h"
index 97959bf..29752e7 100644 (file)
@@ -1,5 +1,5 @@
 #include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
 #include "repository.h"
 #include "config.h"
 #include "commit.h"
index 74a167a..72c33fd 100644 (file)
@@ -1,5 +1,5 @@
 #include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
 #include "repository.h"
 #include "config.h"
 #include "attr.h"
index f649379..545b368 100644 (file)
@@ -1,5 +1,5 @@
 #include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "dir.h"
 #include "parse-options.h"
index e67999e..fd4f59f 100644 (file)
@@ -5,6 +5,7 @@
  */
 #define USE_THE_INDEX_VARIABLE
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "commit.h"
 #include "refs.h"
index 77d2035..62986a7 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "builtin.h"
 #include "parse-options.h"
index 8844f90..dc198f7 100644 (file)
@@ -5,6 +5,7 @@
  */
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
+#include "alloc.h"
 #include "advice.h"
 #include "config.h"
 #include "lockfile.h"
index 4c173d8..9edc785 100644 (file)
@@ -1,5 +1,6 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
+#include "alloc.h"
 #include "repository.h"
 #include "cache.h"
 #include "config.h"
index 855b68e..62ed104 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * Copyright (c) 2011, Google Inc.
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "bulk-checkin.h"
 #include "lockfile.h"
 #include "repository.h"
index 88c2c04..256f98c 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "lockfile.h"
 #include "tree.h"
 #include "tree-walk.h"
diff --git a/cache.h b/cache.h
index 1278990..0f1f9dd 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -656,81 +656,6 @@ void initialize_repository_version(int hash_algo, int reinit);
 void sanitize_stdfds(void);
 int daemonize(void);
 
-#define alloc_nr(x) (((x)+16)*3/2)
-
-/**
- * Dynamically growing an array using realloc() is error prone and boring.
- *
- * Define your array with:
- *
- * - a pointer (`item`) that points at the array, initialized to `NULL`
- *   (although please name the variable based on its contents, not on its
- *   type);
- *
- * - an integer variable (`alloc`) that keeps track of how big the current
- *   allocation is, initialized to `0`;
- *
- * - another integer variable (`nr`) to keep track of how many elements the
- *   array currently has, initialized to `0`.
- *
- * Then before adding `n`th element to the item, call `ALLOC_GROW(item, n,
- * alloc)`.  This ensures that the array can hold at least `n` elements by
- * calling `realloc(3)` and adjusting `alloc` variable.
- *
- * ------------
- * sometype *item;
- * size_t nr;
- * size_t alloc
- *
- * for (i = 0; i < nr; i++)
- *     if (we like item[i] already)
- *             return;
- *
- * // we did not like any existing one, so add one
- * ALLOC_GROW(item, nr + 1, alloc);
- * item[nr++] = value you like;
- * ------------
- *
- * You are responsible for updating the `nr` variable.
- *
- * If you need to specify the number of elements to allocate explicitly
- * then use the macro `REALLOC_ARRAY(item, alloc)` instead of `ALLOC_GROW`.
- *
- * Consider using ALLOC_GROW_BY instead of ALLOC_GROW as it has some
- * added niceties.
- *
- * DO NOT USE any expression with side-effect for 'x', 'nr', or 'alloc'.
- */
-#define ALLOC_GROW(x, nr, alloc) \
-       do { \
-               if ((nr) > alloc) { \
-                       if (alloc_nr(alloc) < (nr)) \
-                               alloc = (nr); \
-                       else \
-                               alloc = alloc_nr(alloc); \
-                       REALLOC_ARRAY(x, alloc); \
-               } \
-       } while (0)
-
-/*
- * Similar to ALLOC_GROW but handles updating of the nr value and
- * zeroing the bytes of the newly-grown array elements.
- *
- * DO NOT USE any expression with side-effect for any of the
- * arguments.
- */
-#define ALLOC_GROW_BY(x, nr, increase, alloc) \
-       do { \
-               if (increase) { \
-                       size_t new_nr = nr + (increase); \
-                       if (new_nr < nr) \
-                               BUG("negative growth in ALLOC_GROW_BY"); \
-                       ALLOC_GROW(x, new_nr, alloc); \
-                       memset((x) + nr, 0, sizeof(*(x)) * (increase)); \
-                       nr = new_nr; \
-               } \
-       } while (0)
-
 /* Initialize and use the cache information */
 struct lock_file;
 void preload_index(struct index_state *index,
index 0275b74..f65e9a1 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "chunk-format.h"
 #include "csum-file.h"
 
index 2e33c59..1f0ddc5 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "commit.h"
 #include "commit-graph.h"
 #include "decorate.h"
index e433740..3afbde7 100644 (file)
@@ -7,6 +7,7 @@
 #include "../strbuf.h"
 #include "../run-command.h"
 #include "../cache.h"
+#include "../alloc.h"
 #include "win32/lazyload.h"
 #include "../config.h"
 #include "dir.h"
index 00090a3..1d22f23 100644 (file)
--- a/config.c
+++ b/config.c
@@ -5,7 +5,8 @@
  * Copyright (C) Johannes Schindelin, 2005
  *
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "date.h"
 #include "branch.h"
 #include "config.h"
index 0ae7d12..eb733d2 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "pkt-line.h"
 #include "run-command.h"
index 8b234cb..1cfdc2c 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "attr.h"
 #include "object.h"
 #include "blob.h"
diff --git a/diff.c b/diff.c
index 329eebf..3c35659 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2,6 +2,7 @@
  * Copyright (C) 2005 Junio C Hamano
  */
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "tempfile.h"
 #include "quote.h"
index c0422d9..62c0299 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2005 Junio C Hamano
  */
 #include "cache.h"
+#include "alloc.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "object-store.h"
index 3764dd8..87364d6 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "dir.h"
 #include "iterator.h"
 #include "dir-iterator.h"
diff --git a/dir.c b/dir.c
index 4e99f0c..d3f1aea 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -5,7 +5,8 @@
  * Copyright (C) Linus Torvalds, 2005-2006
  *              Junio Hamano, 2005-2006
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "dir.h"
 #include "object-store.h"
index ac61864..12d6aa3 100644 (file)
@@ -16,7 +16,8 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "ewok.h"
 
 #define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_EWORD))
index 6fe48d3..c6d4ffc 100644 (file)
@@ -17,9 +17,9 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "git-compat-util.h"
+#include "alloc.h"
 #include "ewok.h"
 #include "ewok_rlw.h"
-#include "cache.h"
 
 static inline size_t min_size(size_t a, size_t b)
 {
index 04016d1..271e2a6 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "repository.h"
 #include "config.h"
 #include "lockfile.h"
index f317f12..d4d6fd3 100644 (file)
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "refs.h"
 #include "object-store.h"
diff --git a/fsck.c b/fsck.c
index 2b18717..20e1aac 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "object-store.h"
 #include "repository.h"
 #include "object.h"
index 899bfe9..b62acf4 100644 (file)
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
+#include "gettext.h"
 #include "repository.h"
 #include "fsmonitor-ipc.h"
 #include "fsmonitor-settings.h"
diff --git a/help.c b/help.c
index 812af4c..5f84a50 100644 (file)
--- a/help.c
+++ b/help.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "builtin.h"
 #include "exec-cmd.h"
index 8ab58e5..d756d12 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "repository.h"
 #include "refs.h"
index a7f3e7f..4956eae 100644 (file)
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "alloc.h"
 #include "line-range.h"
 #include "cache.h"
 #include "tag.h"
index ee01bcd..1d25a57 100644 (file)
@@ -1,6 +1,8 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "commit.h"
 #include "config.h"
+#include "gettext.h"
 #include "revision.h"
 #include "strvec.h"
 #include "list-objects.h"
index 7ed21cb..e40ea9b 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "dir.h"
 #include "tag.h"
 #include "commit.h"
diff --git a/midx.c b/midx.c
index 7cfad04..84d7a53 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "csum-file.h"
 #include "dir.h"
index 939865c..18d6522 100644 (file)
@@ -6,7 +6,8 @@
  * This handles basic git object files - packing, unpacking,
  * creation etc.
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "string-list.h"
 #include "lockfile.h"
index 73ba76e..e8228c7 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "oid-array.h"
 #include "hash-lookup.h"
 
index cfa67a5..155939e 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "object-store.h"
 #include "commit.h"
 #include "tag.h"
index d2a42ab..5a97834 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "commit.h"
 #include "strbuf.h"
 #include "tag.h"
index 272e8d4..ccab09f 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "object.h"
 #include "pack.h"
 #include "pack-objects.h"
index 79e21ab..3e3063d 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "list.h"
 #include "pack.h"
 #include "repository.h"
index 4f6819f..decdc8d 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "entry.h"
 #include "parallel-checkout.h"
index 1e1e218..b608084 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "commit.h"
 #include "utf8.h"
index d31b48e..dc2476b 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "prio-queue.h"
 
 static inline int compare(struct prio_queue *queue, int i, int j)
diff --git a/quote.c b/quote.c
index 26719d2..2453397 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "quote.h"
 #include "strvec.h"
 
index 35e5657..3cc8e31 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "diff.h"
 #include "diffcore.h"
index f8203c6..c8230a0 100644 (file)
@@ -1,5 +1,5 @@
-#include "builtin.h"
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "parse-options.h"
 #include "refs.h"
 #include "wildmatch.h"
@@ -13,7 +13,6 @@
 #include "ref-filter.h"
 #include "revision.h"
 #include "utf8.h"
-#include "git-compat-util.h"
 #include "version.h"
 #include "trailer.h"
 #include "wt-status.h"
index 8a4d8fa..4ba1a10 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "commit.h"
 #include "refs.h"
 #include "diff.h"
diff --git a/refs.c b/refs.c
index e31dbcd..f90f953 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -2,7 +2,8 @@
  * The backend-independent part of the reference module.
  */
 
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "hashmap.h"
 #include "lockfile.h"
index 6f5a070..186dcaf 100644 (file)
@@ -1,4 +1,5 @@
-#include "../cache.h"
+#include "../git-compat-util.h"
+#include "../alloc.h"
 #include "../config.h"
 #include "../refs.h"
 #include "refs-internal.h"
index 32afd8a..dc1ca49 100644 (file)
@@ -1,4 +1,5 @@
-#include "../cache.h"
+#include "../git-compat-util.h"
+#include "../alloc.h"
 #include "../refs.h"
 #include "refs-internal.h"
 #include "ref-cache.h"
index 63e3112..ec336ec 100644 (file)
--- a/refspec.c
+++ b/refspec.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "strvec.h"
 #include "refs.h"
 #include "refspec.h"
index a76b640..380ef3f 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "remote.h"
 #include "connect.h"
index 60869be..daade49 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "remote.h"
 #include "urlmatch.h"
index 876ab43..d4bcb90 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "lockfile.h"
 #include "string-list.h"
index 21f5f57..b8f925f 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "object-store.h"
 #include "tag.h"
index 65a34f9..fcf8740 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "lockfile.h"
 #include "dir.h"
index 0ec6c0c..f07daa1 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "dir.h"
 #include "repository.h"
 #include "refs.h"
index 17f9bcd..7dc73fb 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "repository.h"
 #include "tempfile.h"
 #include "lockfile.h"
index 022677b..ee778c0 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "sigchain.h"
 
 #define SIGCHAIN_MAX_SIGNALS 32
index 147a133..63216b3 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "repository.h"
 #include "sparse-index.h"
 #include "tree.h"
index 5d0f047..95ecfa5 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "split-index.h"
 #include "ewah/ewok.h"
 
index c383f41..bc4c2c0 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "refs.h"
 #include "string-list.h"
 #include "utf8.h"
index 42bacae..db473f2 100644 (file)
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "string-list.h"
+#include "alloc.h"
 
 void string_list_init_nodup(struct string_list *list)
 {
index 61a76ce..94d504e 100644 (file)
--- a/strvec.c
+++ b/strvec.c
@@ -1,5 +1,6 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "strvec.h"
+#include "alloc.h"
 #include "strbuf.h"
 
 const char *empty_strvec[] = { NULL };
index 4dc61b3..bb7c35f 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "dir.h"
 #include "repository.h"
 #include "config.h"
index 3a0dfc4..340ffad 100644 (file)
@@ -1,5 +1,5 @@
-
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "repository.h"
 #include "config.h"
 #include "submodule-config.h"
index 2f65c7f..883d8e2 100644 (file)
@@ -1,5 +1,5 @@
 #include "test-tool.h"
-#include "cache.h"
+#include "alloc.h"
 #include "commit.h"
 #include "commit-reach.h"
 #include "config.h"
index 04900bb..9f46ae1 100644 (file)
@@ -1,5 +1,7 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "thread-utils.h"
+#include "trace.h"
 #include "trace2/tr2_tls.h"
 
 /*
index 0fd5b14..72c3fed 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "string-list.h"
 #include "run-command.h"
index 77a61a9..ac9e06a 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "transport.h"
 #include "hook.h"
@@ -10,6 +11,7 @@
 #include "walker.h"
 #include "bundle.h"
 #include "dir.h"
+#include "gettext.h"
 #include "refs.h"
 #include "refspec.h"
 #include "branch.h"
index 74f4d71..d22f3fe 100644 (file)
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "tree-walk.h"
+#include "alloc.h"
 #include "dir.h"
 #include "object-store.h"
 #include "tree.h"
index 94cca1a..7f0ecbf 100644 (file)
@@ -1,7 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
 #include "userdiff.h"
 #include "attr.h"
+#include "strbuf.h"
 
 static struct userdiff_driver *drivers;
 static int ndrivers;
index aa43c64..c99939a 100644 (file)
@@ -1,4 +1,5 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "repository.h"
 #include "refs.h"
 #include "strbuf.h"