treewide: remove double forward declaration of read_in_full

cache.h's nature of a dumping ground of includes prevented it from being included in some compat/ files, forcing us into a workaround of having a double forward declaration of the read_in_full() function (see commit 14086b0a13 ("compat/pread.c: Add a forward declaration to fix a warning", 2007-11-17)). Now that we have moved functions like read_in_full() from cache.h to wrapper.h, and wrapper.h isn't littered with unrelated and scary #defines, get rid of the extra forward declaration and just have compat/pread.c include wrapper.h. Signed-off-by: Elijah Newren <newren@gmail.com> Acked-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Apr 11, 2023 at 00:42 UTC 65156bb7ec6443ba01edcff3691d878c7a04ede0
12 files changed +11 -6
builtin/clone.c
+1
@@ -42,6 +42,7 @@
42 #include "hook.h"
43 #include "bundle.h"
44 #include "bundle-uri.h"
45 +#include "wrapper.h"
46
47 /*
48 * Overall FIXMEs:
bulk-checkin.c
+1
@@ -17,6 +17,7 @@
17 #include "packfile.h"
18 #include "object-file.h"
19 #include "object-store.h"
20 +#include "wrapper.h"
21
22 static int odb_transaction_nesting;
23
combine-diff.c
+1
@@ -16,6 +16,7 @@
16 #include "userdiff.h"
17 #include "oid-array.h"
18 #include "revision.h"
19 +#include "wrapper.h"
20
21 static int compare_paths(const struct combine_diff_path *one,
22 const struct diff_filespec *two)
compat/pread.c
+1
@@ -1,4 +1,5 @@
1 #include "../git-compat-util.h"
2 +#include "../wrapper.h"
3
4 ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
5 {
git-compat-util.h
-6
@@ -859,12 +859,6 @@ int git_lstat(const char *, struct stat *);
859 #define pread git_pread
860 ssize_t git_pread(int fd, void *buf, size_t count, off_t offset);
861 #endif
862 -/*
863 - * Forward decl that will remind us if its twin in cache.h changes.
864 - * This function is used in compat/pread.c. But we can't include
865 - * cache.h there.
866 - */
867 -ssize_t read_in_full(int fd, void *buf, size_t count);
862
863 #ifdef NO_SETENV
864 #define setenv gitsetenv
grep.c
+1
@@ -11,6 +11,7 @@
11 #include "commit.h"
12 #include "quote.h"
13 #include "help.h"
14 +#include "wrapper.h"
15
16 static int grep_source_load(struct grep_source *gs);
17 static int grep_source_is_binary(struct grep_source *gs,
pack-write.c
+1
@@ -10,6 +10,7 @@
10 #include "oidmap.h"
11 #include "pack-objects.h"
12 #include "pack-revindex.h"
13 +#include "wrapper.h"
14
15 void reset_pack_idx_option(struct pack_idx_option *opts)
16 {
path.c
+1
@@ -18,6 +18,7 @@
18 #include "object-store.h"
19 #include "lockfile.h"
20 #include "exec-cmd.h"
21 +#include "wrapper.h"
22
23 static int get_st_mode_bits(const char *path, int *mode)
24 {
refs/packed-backend.c
+1
@@ -9,6 +9,7 @@
9 #include "../iterator.h"
10 #include "../lockfile.h"
11 #include "../chdir-notify.h"
12 +#include "../wrapper.h"
13 #include "../write-or-die.h"
14
15 enum mmap_strategy {
send-pack.c
+1
@@ -14,6 +14,7 @@
14 #include "quote.h"
15 #include "transport.h"
16 #include "version.h"
17 +#include "wrapper.h"
18 #include "oid-array.h"
19 #include "gpg-interface.h"
20 #include "shallow.h"
setup.c
+1
@@ -12,6 +12,7 @@
12 #include "promisor-remote.h"
13 #include "quote.h"
14 #include "trace2.h"
15 +#include "wrapper.h"
16
17 static int inside_git_dir = -1;
18 static int inside_work_tree = -1;
upload-pack.c
+1
@@ -32,6 +32,7 @@
32 #include "commit-graph.h"
33 #include "commit-reach.h"
34 #include "shallow.h"
35 +#include "wrapper.h"
36 #include "write-or-die.h"
37
38 /* Remember to update object flag allocation in object.h */