treewide: remove unnecessary cache.h includes in source files

We had several C files include cache.h unnecessarily. Replace those with an include of "git-compat-util.h" instead. Much like the previous commit, these have all been verified via both ensuring that gcc -E $SOURCE_FILE | grep '"cache.h"' found no hits and that make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE} successfully compiles without warnings. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Feb 24, 2023 at 00:09 UTC 15db4e7f4ac20cc41902a2479c7784fff8edf2e9
29 files changed +25 -30
hashmap.c
+1 -1
@@ -1,7 +1,7 @@
1 /*
2 * Generic implementation of hash-based key value mappings.
3 */
4 -#include "cache.h"
4 +#include "git-compat-util.h"
5 #include "hashmap.h"
6
7 #define FNV32_BASE ((unsigned int) 0x811c9dc5)
imap-send.c
+1 -1
@@ -21,7 +21,7 @@
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 */
23
24 -#include "cache.h"
24 +#include "git-compat-util.h"
25 #include "config.h"
26 #include "credential.h"
27 #include "exec-cmd.h"
json-writer.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "json-writer.h"
3
4 void jw_init(struct json_writer *jw)
kwset.c
+1 -1
@@ -32,7 +32,7 @@
32 String Matching: An Aid to Bibliographic Search," CACM June 1975,
33 Vol. 18, No. 6, which describes the failure function used below. */
34
35 -#include "cache.h"
35 +#include "git-compat-util.h"
36
37 #include "kwset.h"
38 #include "compat/obstack.h"
levenshtein.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "levenshtein.h"
3
4 /*
linear-assignment.c
+1 -1
@@ -3,7 +3,7 @@
3 * algorithm for dense and sparse linear assignment problems</i>. Computing,
4 * 38(4), 325-340.
5 */
6 -#include "cache.h"
6 +#include "git-compat-util.h"
7 #include "linear-assignment.h"
8
9 #define COST(column, row) cost[(column) + column_count * (row)]
mem-pool.c
+1 -1
@@ -2,7 +2,7 @@
2 * Memory Pool implementation logic.
3 */
4
5 -#include "cache.h"
5 +#include "git-compat-util.h"
6 #include "mem-pool.h"
7
8 #define BLOCK_GROWTH_SIZE (1024 * 1024 - sizeof(struct mp_block))
oidmap.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "oidmap.h"
3
4 static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,
repo-settings.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "config.h"
3 #include "repository.h"
4 #include "midx.h"
serve.c
+2 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "repository.h"
3 #include "config.h"
4 #include "pkt-line.h"
@@ -8,6 +8,7 @@
8 #include "serve.h"
9 #include "upload-pack.h"
10 #include "bundle-uri.h"
11 +#include "trace2.h"
12
13 static int advertise_sid = -1;
14 static int client_hash_algo = GIT_HASH_SHA1;
shell.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "quote.h"
3 #include "exec-cmd.h"
4 #include "strbuf.h"
t/helper/test-crontab.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2
3 /*
4 * Usage: test-tool crontab <file> -l|<input>
t/helper/test-ctype.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2
3 static int rc;
4
t/helper/test-json-writer.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2 #include "json-writer.h"
3
4 static const char *expect_obj1 = "{\"a\":\"abc\",\"b\":42,\"c\":true}";
t/helper/test-pcre2-config.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2 #include "grep.h"
3
4 int cmd__pcre2_config(int argc, const char **argv)
t/helper/test-prio-queue.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2 #include "prio-queue.h"
3
4 static int intcmp(const void *va, const void *vb, void *data)
t/helper/test-run-command.c
-2
@@ -9,8 +9,6 @@
9 */
10
11 #include "test-tool.h"
12 -#include "git-compat-util.h"
13 -#include "cache.h"
12 #include "run-command.h"
13 #include "strvec.h"
14 #include "strbuf.h"
t/helper/test-sigchain.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2 #include "sigchain.h"
3
4 #define X(f) \
t/helper/test-simple-ipc.c
+2 -1
@@ -3,13 +3,14 @@
3 */
4
5 #include "test-tool.h"
6 -#include "cache.h"
6 +#include "gettext.h"
7 #include "strbuf.h"
8 #include "simple-ipc.h"
9 #include "parse-options.h"
10 #include "thread-utils.h"
11 #include "strvec.h"
12 #include "run-command.h"
13 +#include "trace2.h"
14
15 #ifndef SUPPORTS_SIMPLE_IPC
16 int cmd__simple_ipc(int argc, const char **argv)
t/helper/test-wildmatch.c
-1
@@ -1,5 +1,4 @@
1 #include "test-tool.h"
2 -#include "cache.h"
2
3 int cmd__wildmatch(int argc, const char **argv)
4 {
thread-utils.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "thread-utils.h"
3
4 #if defined(hpux) || defined(__hpux) || defined(_hpux)
trace2.c
+2 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "config.h"
3 #include "json-writer.h"
4 #include "quote.h"
@@ -6,6 +6,7 @@
6 #include "sigchain.h"
7 #include "thread-utils.h"
8 #include "version.h"
9 +#include "trace.h"
10 #include "trace2/tr2_cfg.h"
11 #include "trace2/tr2_cmd_name.h"
12 #include "trace2/tr2_ctr.h"
trace2/tr2_ctr.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "thread-utils.h"
3 #include "trace2/tr2_tgt.h"
4 #include "trace2/tr2_tls.h"
trace2/tr2_tbuf.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "tr2_tbuf.h"
3
4 void tr2_tbuf_local_time(struct tr2_tbuf *tb)
trace2/tr2_tgt_event.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "config.h"
3 #include "json-writer.h"
4 #include "run-command.h"
trace2/tr2_tgt_normal.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "config.h"
3 #include "run-command.h"
4 #include "quote.h"
trace2/tr2_tgt_perf.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "config.h"
3 #include "run-command.h"
4 #include "quote.h"
trace2/tr2_tmr.c
+2 -1
@@ -1,8 +1,9 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "thread-utils.h"
3 #include "trace2/tr2_tgt.h"
4 #include "trace2/tr2_tls.h"
5 #include "trace2/tr2_tmr.h"
6 +#include "trace.h"
7
8 #define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
9 #define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
unix-stream-server.c
+1 -1
@@ -1,4 +1,4 @@
1 -#include "cache.h"
1 +#include "git-compat-util.h"
2 #include "lockfile.h"
3 #include "unix-socket.h"
4 #include "unix-stream-server.h"