Code

compat-util: avoid macro redefinition warning
authorJohannes Sixt <j.sixt@viscovery.net>
Thu, 8 May 2008 07:34:49 +0000 (09:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 May 2008 00:47:25 +0000 (17:47 -0700)
Some systems define fopen as a macro based on compiler settings, and
unconditionally redefining it triggers a compilation warning.

git-compat-util.h

index 167c3fe63a4fd9ca4abf5c16694e22a9ae22717b..01c4045e89a2e156062255193ed5d865fdf8a922 100644 (file)
@@ -206,6 +206,9 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
 #endif
 
 #ifdef FREAD_READS_DIRECTORIES
+#ifdef fopen
+#undef fopen
+#endif
 #define fopen(a,b) git_fopen(a,b)
 extern FILE *git_fopen(const char*, const char*);
 #endif