From 31023be9997d657dc653fe3358be50d1e7268a31 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sat, 17 Nov 2007 20:48:14 +0100 Subject: [PATCH] compat/pread.c: Add foward decl to fix 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 decl 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 --- compat/pread.c | 2 -- git-compat-util.h | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compat/pread.c b/compat/pread.c index ce29997724..978cac4ec9 100644 --- a/compat/pread.c +++ b/compat/pread.c @@ -1,7 +1,5 @@ #include "../git-compat-util.h" -int read_in_full(int fd, void *buf, size_t count); - ssize_t git_pread(int fd, void *buf, size_t count, off_t offset) { off_t current_offset; diff --git a/git-compat-util.h b/git-compat-util.h index eb4d96944e..f4e0d08357 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -153,6 +153,10 @@ extern int git_munmap(void *start, size_t length); #define pread git_pread extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); #endif +/* Forward decl that will remind us if its twin in cache.h changes. + This function in used in compat/pread.c. But we can't include + cache.h there. */ +extern int read_in_full(int fd, void *buf, size_t count); #ifdef NO_SETENV #define setenv gitsetenv