git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Emily Shaffer <nasamuffin@google.com>,
	Derrick Stolee <derrickstolee@github.com>,
	Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>,
	Elijah Newren <newren@gmail.com>
Subject: [PATCH v2 04/17] treewide: remove unnecessary cache.h includes in source files
Date: Fri, 24 Feb 2023 00:09:23 +0000	[thread overview]
Message-ID: <00dceb5b4679ada9570a68e8a13ea154f5475979.1677197377.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1485.v2.git.1677197376.gitgitgadget@gmail.com>

From: Elijah Newren <newren@gmail.com>

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>
---
 hashmap.c                    | 2 +-
 imap-send.c                  | 2 +-
 json-writer.c                | 2 +-
 kwset.c                      | 2 +-
 levenshtein.c                | 2 +-
 linear-assignment.c          | 2 +-
 mem-pool.c                   | 2 +-
 oidmap.c                     | 2 +-
 repo-settings.c              | 2 +-
 serve.c                      | 3 ++-
 shell.c                      | 2 +-
 t/helper/test-crontab.c      | 1 -
 t/helper/test-ctype.c        | 1 -
 t/helper/test-json-writer.c  | 1 -
 t/helper/test-pcre2-config.c | 1 -
 t/helper/test-prio-queue.c   | 1 -
 t/helper/test-run-command.c  | 2 --
 t/helper/test-sigchain.c     | 1 -
 t/helper/test-simple-ipc.c   | 3 ++-
 t/helper/test-wildmatch.c    | 1 -
 thread-utils.c               | 2 +-
 trace2.c                     | 3 ++-
 trace2/tr2_ctr.c             | 2 +-
 trace2/tr2_tbuf.c            | 2 +-
 trace2/tr2_tgt_event.c       | 2 +-
 trace2/tr2_tgt_normal.c      | 2 +-
 trace2/tr2_tgt_perf.c        | 2 +-
 trace2/tr2_tmr.c             | 3 ++-
 unix-stream-server.c         | 2 +-
 29 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/hashmap.c b/hashmap.c
index cf5fea87eb0..ee45ef00852 100644
--- a/hashmap.c
+++ b/hashmap.c
@@ -1,7 +1,7 @@
 /*
  * Generic implementation of hash-based key value mappings.
  */
-#include "cache.h"
+#include "git-compat-util.h"
 #include "hashmap.h"
 
 #define FNV32_BASE ((unsigned int) 0x811c9dc5)
diff --git a/imap-send.c b/imap-send.c
index a50af56b827..93e9018439c 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -21,7 +21,7 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
 #include "credential.h"
 #include "exec-cmd.h"
diff --git a/json-writer.c b/json-writer.c
index f1cfd8fa8c6..005c820aa42 100644
--- a/json-writer.c
+++ b/json-writer.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "json-writer.h"
 
 void jw_init(struct json_writer *jw)
diff --git a/kwset.c b/kwset.c
index 08aadf03117..4b14d4f86b8 100644
--- a/kwset.c
+++ b/kwset.c
@@ -32,7 +32,7 @@
    String Matching:  An Aid to Bibliographic Search," CACM June 1975,
    Vol. 18, No. 6, which describes the failure function used below. */
 
-#include "cache.h"
+#include "git-compat-util.h"
 
 #include "kwset.h"
 #include "compat/obstack.h"
diff --git a/levenshtein.c b/levenshtein.c
index d2632690d51..fd8026fe201 100644
--- a/levenshtein.c
+++ b/levenshtein.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "levenshtein.h"
 
 /*
diff --git a/linear-assignment.c b/linear-assignment.c
index ecffc09be6e..5416cbcf409 100644
--- a/linear-assignment.c
+++ b/linear-assignment.c
@@ -3,7 +3,7 @@
  * algorithm for dense and sparse linear assignment problems</i>. Computing,
  * 38(4), 325-340.
  */
-#include "cache.h"
+#include "git-compat-util.h"
 #include "linear-assignment.h"
 
 #define COST(column, row) cost[(column) + column_count * (row)]
diff --git a/mem-pool.c b/mem-pool.c
index 599d8e895f8..c34846d176c 100644
--- a/mem-pool.c
+++ b/mem-pool.c
@@ -2,7 +2,7 @@
  * Memory Pool implementation logic.
  */
 
-#include "cache.h"
+#include "git-compat-util.h"
 #include "mem-pool.h"
 
 #define BLOCK_GROWTH_SIZE (1024 * 1024 - sizeof(struct mp_block))
diff --git a/oidmap.c b/oidmap.c
index 49965fe8568..8c1a139c974 100644
--- a/oidmap.c
+++ b/oidmap.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "oidmap.h"
 
 static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,
diff --git a/repo-settings.c b/repo-settings.c
index 3dbd3f0e2ec..0a6c0b381fe 100644
--- a/repo-settings.c
+++ b/repo-settings.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
 #include "repository.h"
 #include "midx.h"
diff --git a/serve.c b/serve.c
index cbf4a143cfe..d128822347d 100644
--- a/serve.c
+++ b/serve.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "repository.h"
 #include "config.h"
 #include "pkt-line.h"
@@ -8,6 +8,7 @@
 #include "serve.h"
 #include "upload-pack.h"
 #include "bundle-uri.h"
+#include "trace2.h"
 
 static int advertise_sid = -1;
 static int client_hash_algo = GIT_HASH_SHA1;
diff --git a/shell.c b/shell.c
index af0d7c734f8..5c67e7bd97e 100644
--- a/shell.c
+++ b/shell.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "quote.h"
 #include "exec-cmd.h"
 #include "strbuf.h"
diff --git a/t/helper/test-crontab.c b/t/helper/test-crontab.c
index e6c1b1e22bb..597027a96e9 100644
--- a/t/helper/test-crontab.c
+++ b/t/helper/test-crontab.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 
 /*
  * Usage: test-tool crontab <file> -l|<input>
diff --git a/t/helper/test-ctype.c b/t/helper/test-ctype.c
index 92c4c2313e7..d6c1a2ed09c 100644
--- a/t/helper/test-ctype.c
+++ b/t/helper/test-ctype.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 
 static int rc;
 
diff --git a/t/helper/test-json-writer.c b/t/helper/test-json-writer.c
index 8c3edacc000..86887f53203 100644
--- a/t/helper/test-json-writer.c
+++ b/t/helper/test-json-writer.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 #include "json-writer.h"
 
 static const char *expect_obj1 = "{\"a\":\"abc\",\"b\":42,\"c\":true}";
diff --git a/t/helper/test-pcre2-config.c b/t/helper/test-pcre2-config.c
index 5258fdddba0..5d0b2a2e10f 100644
--- a/t/helper/test-pcre2-config.c
+++ b/t/helper/test-pcre2-config.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 #include "grep.h"
 
 int cmd__pcre2_config(int argc, const char **argv)
diff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c
index 133b5e6f4ae..ac4c65d7056 100644
--- a/t/helper/test-prio-queue.c
+++ b/t/helper/test-prio-queue.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 #include "prio-queue.h"
 
 static int intcmp(const void *va, const void *vb, void *data)
diff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c
index 3ecb830f4a8..67b42ef50eb 100644
--- a/t/helper/test-run-command.c
+++ b/t/helper/test-run-command.c
@@ -9,8 +9,6 @@
  */
 
 #include "test-tool.h"
-#include "git-compat-util.h"
-#include "cache.h"
 #include "run-command.h"
 #include "strvec.h"
 #include "strbuf.h"
diff --git a/t/helper/test-sigchain.c b/t/helper/test-sigchain.c
index d013bccddae..d1cf7377b7c 100644
--- a/t/helper/test-sigchain.c
+++ b/t/helper/test-sigchain.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 #include "sigchain.h"
 
 #define X(f) \
diff --git a/t/helper/test-simple-ipc.c b/t/helper/test-simple-ipc.c
index 28365ff85b6..3d1436da598 100644
--- a/t/helper/test-simple-ipc.c
+++ b/t/helper/test-simple-ipc.c
@@ -3,13 +3,14 @@
  */
 
 #include "test-tool.h"
-#include "cache.h"
+#include "gettext.h"
 #include "strbuf.h"
 #include "simple-ipc.h"
 #include "parse-options.h"
 #include "thread-utils.h"
 #include "strvec.h"
 #include "run-command.h"
+#include "trace2.h"
 
 #ifndef SUPPORTS_SIMPLE_IPC
 int cmd__simple_ipc(int argc, const char **argv)
diff --git a/t/helper/test-wildmatch.c b/t/helper/test-wildmatch.c
index 2c103d1824c..a95bb4da9b1 100644
--- a/t/helper/test-wildmatch.c
+++ b/t/helper/test-wildmatch.c
@@ -1,5 +1,4 @@
 #include "test-tool.h"
-#include "cache.h"
 
 int cmd__wildmatch(int argc, const char **argv)
 {
diff --git a/thread-utils.c b/thread-utils.c
index 53298456913..1f89ffab4c3 100644
--- a/thread-utils.c
+++ b/thread-utils.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "thread-utils.h"
 
 #if defined(hpux) || defined(__hpux) || defined(_hpux)
diff --git a/trace2.c b/trace2.c
index 279bddf53b4..e8ba62c0c3d 100644
--- a/trace2.c
+++ b/trace2.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
 #include "json-writer.h"
 #include "quote.h"
@@ -6,6 +6,7 @@
 #include "sigchain.h"
 #include "thread-utils.h"
 #include "version.h"
+#include "trace.h"
 #include "trace2/tr2_cfg.h"
 #include "trace2/tr2_cmd_name.h"
 #include "trace2/tr2_ctr.h"
diff --git a/trace2/tr2_ctr.c b/trace2/tr2_ctr.c
index 483ca7c308f..b342d3b1a3c 100644
--- a/trace2/tr2_ctr.c
+++ b/trace2/tr2_ctr.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "thread-utils.h"
 #include "trace2/tr2_tgt.h"
 #include "trace2/tr2_tls.h"
diff --git a/trace2/tr2_tbuf.c b/trace2/tr2_tbuf.c
index 2498482d9ad..c3b3822ed7e 100644
--- a/trace2/tr2_tbuf.c
+++ b/trace2/tr2_tbuf.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "tr2_tbuf.h"
 
 void tr2_tbuf_local_time(struct tr2_tbuf *tb)
diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c
index 16f6332755e..9e7aab6d510 100644
--- a/trace2/tr2_tgt_event.c
+++ b/trace2/tr2_tgt_event.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
 #include "json-writer.h"
 #include "run-command.h"
diff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c
index fbbef68dfc0..8672c2c2d04 100644
--- a/trace2/tr2_tgt_normal.c
+++ b/trace2/tr2_tgt_normal.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
 #include "run-command.h"
 #include "quote.h"
diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c
index adae8032639..3f2b2d53118 100644
--- a/trace2/tr2_tgt_perf.c
+++ b/trace2/tr2_tgt_perf.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "config.h"
 #include "run-command.h"
 #include "quote.h"
diff --git a/trace2/tr2_tmr.c b/trace2/tr2_tmr.c
index 786762dfd26..31d0e4d1bd1 100644
--- a/trace2/tr2_tmr.c
+++ b/trace2/tr2_tmr.c
@@ -1,8 +1,9 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "thread-utils.h"
 #include "trace2/tr2_tgt.h"
 #include "trace2/tr2_tls.h"
 #include "trace2/tr2_tmr.h"
+#include "trace.h"
 
 #define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
 #define MY_MIN(a, b) ((a) < (b) ? (a) : (b))
diff --git a/unix-stream-server.c b/unix-stream-server.c
index efa2a207abc..22ac2373e07 100644
--- a/unix-stream-server.c
+++ b/unix-stream-server.c
@@ -1,4 +1,4 @@
-#include "cache.h"
+#include "git-compat-util.h"
 #include "lockfile.h"
 #include "unix-socket.h"
 #include "unix-stream-server.h"
-- 
gitgitgadget


  parent reply	other threads:[~2023-02-24  0:10 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23  8:05 [PATCH 00/16] Header cleanups Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 01/16] treewide: ensure one of the appropriate headers is sourced first Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 02/16] treewide: remove unnecessary git-compat-util.h includes in headers Elijah Newren via GitGitGadget
2023-02-23 13:52   ` Derrick Stolee
2023-02-23 18:13     ` Elijah Newren
2023-02-23 19:35   ` Junio C Hamano
2023-02-23 19:53     ` Elijah Newren
2023-02-23 22:07       ` Junio C Hamano
2023-02-23 23:41         ` Elijah Newren
2023-02-23  8:05 ` [PATCH 03/16] treewide: remove unnecessary cache.h includes Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 04/16] treewide: remove unnecessary cache.h includes in source files Elijah Newren via GitGitGadget
2023-02-23 13:57   ` Derrick Stolee
2023-02-23  8:05 ` [PATCH 05/16] alloc.h: move ALLOC_GROW() functions from cache.h Elijah Newren via GitGitGadget
2023-02-23 14:06   ` Derrick Stolee
2023-02-23 18:22     ` Elijah Newren
2023-02-23 19:40     ` Junio C Hamano
2023-02-23 19:39   ` Junio C Hamano
2023-02-23  8:05 ` [PATCH 06/16] hash.h: move some oid-related declarations " Elijah Newren via GitGitGadget
2023-02-23 14:08   ` Derrick Stolee
2023-02-23 18:25     ` Elijah Newren
2023-02-24 23:55   ` Jonathan Tan
2023-02-23  8:05 ` [PATCH 07/16] hex.h: move some hex-related " Elijah Newren via GitGitGadget
2023-02-23 14:11   ` Derrick Stolee
2023-02-23 19:31     ` Elijah Newren
2023-02-23  8:05 ` [PATCH 08/16] pretty.h: move has_non_ascii() declaration from commit.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 09/16] ident.h: move ident-related declarations out of cache.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 10/16] object.h: stop depending on cache.h; make cache.h depend on object.h Elijah Newren via GitGitGadget
2023-02-23 14:17   ` Derrick Stolee
2023-02-23 19:55     ` Elijah Newren
2023-02-23  8:05 ` [PATCH 11/16] dir.h: refactor to no longer need to include cache.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 12/16] object-store.h: move struct object_info from cache.h Elijah Newren via GitGitGadget
2023-02-23 14:20   ` Derrick Stolee
2023-02-23 19:55     ` Elijah Newren
2023-02-23  8:05 ` [PATCH 13/16] replace-object.h: move read_replace_refs declaration from cache.h to here Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 14/16] treewide: replace cache.h with more direct headers, where possible Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 15/16] Remove unnecessary includes of builtin.h Elijah Newren via GitGitGadget
2023-02-23  8:05 ` [PATCH 16/16] diff.h: remove unnecessary include of object.h Elijah Newren via GitGitGadget
2023-02-23 14:27 ` [PATCH 00/16] Header cleanups Derrick Stolee
2023-02-24  0:09 ` [PATCH v2 00/17] " Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 01/17] treewide: ensure one of the appropriate headers is sourced first Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 02/17] treewide: remove unnecessary git-compat-util.h includes in headers Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 03/17] treewide: remove unnecessary cache.h includes Elijah Newren via GitGitGadget
2023-02-24  0:09   ` Elijah Newren via GitGitGadget [this message]
2023-02-24  0:09   ` [PATCH v2 05/17] alloc.h: move ALLOC_GROW() functions from cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 06/17] hash.h: move some oid-related declarations " Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 07/17] hex.h: move some hex-related " Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 08/17] cache.h: remove dependence on hex.h; make other files include it explicitly Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 09/17] pretty.h: move has_non_ascii() declaration from commit.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 10/17] ident.h: move ident-related declarations out of cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 11/17] object.h: stop depending on cache.h; make cache.h depend on object.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 12/17] dir.h: refactor to no longer need to include cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 13/17] object-store.h: move struct object_info from cache.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 14/17] replace-object.h: move read_replace_refs declaration from cache.h to here Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 15/17] treewide: replace cache.h with more direct headers, where possible Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 16/17] Remove unnecessary includes of builtin.h Elijah Newren via GitGitGadget
2023-02-24  0:09   ` [PATCH v2 17/17] diff.h: remove unnecessary include of object.h Elijah Newren via GitGitGadget
2023-02-24 14:03   ` [PATCH v2 00/17] Header cleanups Johannes Schindelin
2023-02-25  0:10   ` Jonathan Tan
2023-02-25  0:57     ` Elijah Newren
2023-02-27 13:51   ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00dceb5b4679ada9570a68e8a13ea154f5475979.1677197377.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=nasamuffin@google.com \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).