@matheusbsbs / matheus-bagliano / commits / 14086b0a13
Fork 0

compat/pread.c: Add a forward declaration to fix a warning

read_in_full()'s is used in compat/pread.c. read_in_full() is declared in cache.h. But we can't include cache.h because too many macros are defined there. Using read_in_full() without including cache.h is dangerous because we wouldn't recognize if its prototyp changed. gcc issues a warning about that. This commit adds a forward declaration to git-compat-util.h. git-compat-util.h is included by compat/pread.c _and_ cache.h. Hence, changes in cache.h would be detected. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>

Steffen Prohaska committed Nov 17, 2007 at 20:48 UTC 14086b0a13f5f5ac456cb9ae16a263f92908ae61
1 file changed +6
git-compat-util.h
+6
@@ -185,6 +185,12 @@ extern int git_munmap(void *start, size_t length);
185 #define pread git_pread
186 extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset);
187 #endif
188 +/*
189 + * Forward decl that will remind us if its twin in cache.h changes.
190 + * This function is used in compat/pread.c. But we can't include
191 + * cache.h there.
192 + */
193 +extern ssize_t read_in_full(int fd, void *buf, size_t count);
194
195 #ifdef NO_SETENV
196 #define setenv gitsetenv