]> git.ipfire.org Git - thirdparty/git.git/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 a86a92e16461384cbe8ac880fa6515e0f74e243c..c6e451c136c05f9f3690ddd6017f3374b0ea217e 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 00abde081739436236aa077412c3b5b686144f42..e814948ced329937a5ad2e0a6c5b17b05a653183 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 3f4a0ad310a94bd026f48f48491985e3e2053ee2..4312db4bd087bde3632c547bb72d0b5cc77be713 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 5cc5479c9c356fb955839fc808d0742d1d54b8e5..7f12ebf04c5d6dd74cba80c02a9ff7bd1ddcb9f5 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 f8fad2946ef97324756b78363fb90d329f504209..9406f03e80419688ec3f607efd18c5737acac111 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 f2a8756d84fedefd63cb16e942fa9ed0f82d18b0..35719e5e3670b0badeea74030dcae71daf010b43 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 1053dfcd4b61b56e99df60e469ec4e757c80e860..657ee52229ee3efca65a7e6e5dcadbc83cbbbe70 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 71f925e456c34513b85e64e7dd6a72d510a8307e..4d1609c9ac0575f92311b9c74ac9d20f172d49f2 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 cc17635e76536471a0a756903a8187eaa01d5733..5b8be7cb63b7fc5fb45bab914b900066b102bbe7 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 ede7dc32a43c01a78a0074e1bddd5ba18b487568..0a7d762573ce3b99550161b1119914f880b6ddd2 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "entry.h"
 #include "parallel-checkout.h"
index 060cf9f3e05e6718ae02923e132e4804dbdcb291..ca006e9cc15f4fede375dc843a68457e228bb2d9 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 f3c89831d4a27fb5a2637433ffa724ff0b5e9656..590aefc6ead2893d018c4a724768bdfd79a1518a 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "parse-options.h"
 
 #ifndef NO_UNIX_SOCKETS
index afe679368deec2a0288de1606259b73847ce434b..113f22c09ddb1ad4a4e1cd4b2eb5c222b8a7fdf1 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "pkt-line.h"
 #include "fetch-pack.h"
 #include "remote.h"
index 0feef8caf6d5e27d508b3d4ea3e2679cd50a9966..cae804a190808bf787ad098f749c721d440c1036 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "parse-options.h"
 #include "fsmonitor.h"
index f7821c5fbbaeda3888f3011ee5215393e1319952..a08e5841ddb842bd9f8c9058567229b3b41f83e1 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 6648f2daef5cef38fd59dfba47c048ce72bb4c36..7e4b69f9a3e6c69a336d4c7910250740a48ce125 100644 (file)
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "alloc.h"
 #include "config.h"
 #include "delta.h"
 #include "pack.h"
index 04412dd9c936569506c1ca932a7804059a57904f..85540963d950f3086602f036df71382b18c4ad85 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 0a3c10a0966bdfc8f354cffb19d8f27987298600..716a23f880dfb84aa294751785faf485b35109dc 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 06d81400f558152292718a57c384e12078e2b9be..ec721ffb947fc584f02188c4fe813ef8e3a57131 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 edd7b931fdb95f84eec899acbf0b4ae2a120f2d7..8129050377529e99cb851f08876b7a013a8f5f27 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 97959bfaf9eb018dbe83780f60093e3f04f7be42..29752e7afe68240dfe788e86f19bc77859e54c03 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 74a167a180cd4080919d8c3a614c098ad96a2b42..72c33fd739a66f1fddb3699bd5fb9733ba57d080 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 f64937953184fd346923bafed6f7868bd99cded5..545b368168f433275b15c1b0c63cb38ce2e4cfb5 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 e67999e5ebc5ef640fe5dcd45dfa1b4126a9c7a8..fd4f59ff2b9e7e628d731390f907667b75a9d7bd 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 77d2035616efa1aa60b412f024da1a7836df4478..62986a7b1b07984a8f1af60cf93fb24492c3d0b4 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 8844f90655799b16f59080c8a69ca86fcbb9fd6f..dc198f79082093f3ac95b39801b6ab890ae7bd4b 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 4c173d8b37adfc72ec840fd88ca27e36f432aef3..9edc785d8d22842628344370fcc9048282fcfd03 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 855b68ec23bdb1bdc85c1184a9c144c226f0245c..62ed104c7e6f3d4bde7dad8b83dbe094c55dfb26 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 88c2c04f87fe5fcfce380b47f9d9377f9b59d8ef..256f98c3c33678e7362fc734da224556b8917efb 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 12789903e883df94783b75defa89fbbd5cbcca1f..0f1f9dde56b49d43add29a28eb2bb230a23ce141 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 0275b74a895a17bb62b7fe12299e6f12aa503d92..f65e9a1e4290c1b704e61c0c9909c61c14bf67da 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 2e33c599a82c81127b9a24547d0834e6c7a55bcf..1f0ddc5c8830d46ec932e78e7ec63f9e1a6d6815 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 e433740381be9cad8cd6c7453508931684832209..3afbde789449c786873733dba935eb9a00cdc04b 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 00090a32fc3a2bd82fe01f9060eb7b0b4f7b8ca1..1d22f2325165c1d0bb40f11279013933dcd30fec 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 0ae7d12b5c132883907192d16c3e2f04d56a80fb..eb733d222fa893115f624069113e2226102bae46 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 8b234cb85b03b26b3f7360420e65a8e88c6b2df0..1cfdc2cc040a842f7b6d4f4857e57afd19f395cb 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 329eebf16a0b100cb3de9afb530e4cac25fede4c..3c3565995d9bac3826c6528e44fdcb457528f968 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 c0422d9e709a65d5a77d1444fcff0a4d313299bd..62c0299984eec1c8bc3a9f18273f070492a95774 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 3764dd81a185b296a5d4c0a9fc8c0ae2bd4085ec..87364d68a2e222281820ce2817317eda07e600cc 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 4e99f0c868f3d7955c4a6f84bf22bbce0d917ae3..d3f1aeaca3ba33fb44bb7c3a37917b61b5999243 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 ac618641632f8c347b2a2900fb15b0de9ed8dd8a..12d6aa398e907f83eeaee9e9635ccbf11220ce35 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 6fe48d3ae0449a0298deb109b967ef3479ef0c47..c6d4ffc87cacaaaefb3edf4f81f62f7481b4b742 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 04016d1e3250f28ae6cd53a784913f02879769d8..271e2a6fbd641370380eea61fd92092372b9161c 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 f317f129904e79b04c0d21b763a22963a8a8e16c..d4d6fd3d9d91906fe5c530919154c9d223cbb0d5 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 2b18717ee805bc73aa50943731ac9a7212303d18..20e1aac39a9626de2266ba67a41738aa244fa2ad 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 899bfe9c8138e1ae46f1fd0f0dfc7aebba05b81a..b62acf44aee2b9c029fac4389f6af7e4c4df6dab 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 812af4cdea62129c12ec33813d934d677c61d714..5f84a50b948ef84ca5df5127b4570f44ba9cb768 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 8ab58e55f8524851fa77e047e9b9a5dfd31eb6bd..d756d120dc9f006f9c16df39ecae19ea523fde6a 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 a7f3e7f6ce43e0ce4786e417608a1a43bac47105..4956eae748eddcd811f17f5d6920143ad99afe86 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 ee01bcd2cc365c12c72bcd3f5597ecceecb2a7d9..1d25a5737db24d8eb2e0fb918e0a0d0347ba8ca6 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 7ed21cb299c126fb2d2107eb3e418a18e64fbc6c..e40ea9b0a8f50a9f598aefe813f71f028124b930 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 7cfad04a24027c1f0703dafdeeb31989414a13c5..84d7a53d66d3ef6bbbabd5f296749a1c52e9d19c 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 939865c1ae0566ba577861505f2ecf2e9fd19eeb..18d65220d70b035ed7376065461f1af43decf37b 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 73ba76e9e9a223306a03c3d04123c0c4af4aeda2..e8228c777b1619d6bd1baaac0e24f14124d3e4d3 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 cfa67a510fd9a98ec5461084d08373086de858d5..155939e77b24648c125e6047a675f8e5548544e3 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 d2a42abf28cc7246b3d076b1c855a350edcded70..5a9783412006f7690f6301a2aeb924d0e2cf83a5 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 272e8d451739e8466a35df155520c9c54d85e75c..ccab09fe654391ef8da95c4f4ecf0bf55d5f3df7 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 79e21ab18e7844461c3743e45ebb7ccc1022caea..3e3063de445a0141eb56a66874c3ba73547c4a73 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 4f6819f2406ea8f90651b7769cbaf1758ce4c098..decdc8d8a1eb5478d4c9afded40cb81299d59157 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "entry.h"
 #include "parallel-checkout.h"
index 1e1e21878c833d54b165b0aa6d9720eb16536a94..b6080844498a1523b179d4563df034b267ae14bb 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 d31b48e725083654222842049e121a35fe8d511b..dc2476be53a30a6e9c682d934f620422dd855ada 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 26719d21d1e7555d92289b26402a73030e330606..2453397fbbd11062b574bcd8d80449df0f29ed21 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 35e5657877c7a4ebd070654f7b252a99f05d702f..3cc8e312dce2d3f4143da0d92df2b41722f1cfdc 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 f8203c6b05254b624cf98e6d4590d07064cbb101..c8230a08589f1dfc82b1c2962ed3ed51289db1cc 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 8a4d8fa3bd5589fca43e97b05982a830af8bd27a..4ba1a10c82cdd3920a1c2818de29a18e1ea153ca 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 e31dbcda5990b8f2e7143547ce134b7218041fd2..f90f953551b959ab6f904586376c5d361eea10db 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 6f5a0709fba65e80081fdb04563019e1f1e15400..186dcafcd005dc806946365e7dc0ca79fd763c6b 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 32afd8a40b0faf22d1ef2de5bb2a2990fa6eebb3..dc1ca49c85f7cd4be86d88dda0ba31f3f965e6bb 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 63e3112104a949e28e0cae1c8beaee0c27c099f1..ec336ec5e9ce087c94e9495e4d841d1a667cb029 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 a76b6405eb2fc443ff22b93b1598892d02508e20..380ef3fccfb6077de22e32c66b314214fc7ee5ce 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 60869beebe7364a594cd45938d4ed97dcdd28840..daade49a6f617ce06224005cda5fbd948ed9f1d4 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 876ab435da949c8359c315636225d9fd7fd962ab..d4bcb908531a693038deb0d9cc04ba715c4a1bba 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 21f5f572c22ec7054da6bc20fef26ee2a59a19d5..b8f925f088cce93a5d8151d9aa662daf71efd72c 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 65a34f9676c63176cde7b3204aaa993217056369..fcf8740ce1c4b8269045e6a42c81a792aa1b4d34 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "config.h"
 #include "lockfile.h"
 #include "dir.h"
index 0ec6c0c16546a7a2ebb45a8e8a03e3270cedf214..f07daa16f36e3c63c96b0c9c2b1123fb2e02f65d 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 17f9bcdb5f38270c4f5910a2e1c930432ba350e5..7dc73fb89898c10571904c06c37d5fbca4ee4d5e 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 022677b6abaf918f51804a8fcbf18776aa3f2be5..ee778c0580b6d9eb47ebc0d5f1ea7a9d7637a96c 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 147a13386a445b7278b87c5072d7d5c308a35b8f..63216b3e57f87f0a44749c9350f12d8cb6b45785 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "repository.h"
 #include "sparse-index.h"
 #include "tree.h"
index 5d0f04763ea2d201a3bbe417bd1951aea23a8436..95ecfa531954e92947bd13175b760d680f18d0be 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "split-index.h"
 #include "ewah/ewok.h"
 
index c383f41a3c5ccc6c6228c4ed4f9631529633f878..bc4c2c09e6026ad46e502b14f8b181631cc0bbd3 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 42bacaec55b6ca6bf885797c1c76fc6e964ddfbd..db473f273e1f77c45f2a5b0cf7a70b106bc19d02 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 61a76ce6cb920f33744e82111c800da8439ed975..94d504e3805bb559119b362281e1c61bb79c8ac5 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 4dc61b3a78a2916d737edf613af0f9c0e03d39c8..bb7c35fc317d9db622ae2ad43fd7c5f60688011b 100644 (file)
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "alloc.h"
 #include "dir.h"
 #include "repository.h"
 #include "config.h"
index 3a0dfc417c05b627a5100f518768a1b32ee22339..340ffad1c29b52f0e299cd2e37b1c7f79d36d3d5 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 2f65c7f6a55bc146ea69ea9ef85d45a1f6172ac3..883d8e20a8e7a60addd16faa377061d1f2a18ba5 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 04900bb4c3a88cb43e5a79f7d6554e2236e52db8..9f46ae12f50f3ac9530db2d53879b03742f769fe 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 0fd5b142a377056d1e45f8dfd1ff6ae7a9c40097..72c3fed5c6e89c758c761eff4c9bb80158b88fa7 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 77a61a9d7bb06a5cfc7992c6fc4f9f3aa8a8ada5..ac9e06a6ceaf22d86da5d5d43852ba46523b664b 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 74f4d710e8f0f28410fae49a6b9c31bf1045e0ca..d22f3fe5b05cf84f6ba3bae1357903e9b04ab30b 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 94cca1a2a8ee14e83a0410a7f1c4d5246a8196d1..7f0ecbffbb5ba7f8b383533c52fa62004a0031e4 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 aa43c6411914308798a58e4e3a0a5c55d1eede8f..c99939a4d1fa1a54e04db4d76b1954246a2c74a5 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"