Code

detect close failure on just-written file handles
[git.git] / cache.h
diff --git a/cache.h b/cache.h
index 6761554e6ca073e9c63c74b58834ab2195cf07ce..ed83d92c5a2735b2b7f8a7fc06276acbf0df8b18 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -234,8 +234,11 @@ extern void verify_non_filename(const char *prefix, const char *name);
  */
 #define ALLOC_GROW(x, nr, alloc) \
        do { \
-               if ((nr) >= alloc) { \
-                       alloc = alloc_nr(alloc); \
+               if ((nr) > alloc) { \
+                       if (alloc_nr(alloc) < (nr)) \
+                               alloc = (nr); \
+                       else \
+                               alloc = alloc_nr(alloc); \
                        x = xrealloc((x), alloc * sizeof(*(x))); \
                } \
        } while(0)
@@ -369,7 +372,6 @@ extern int move_temp_to_file(const char *tmpfile, const char *filename);
 
 extern int has_sha1_pack(const unsigned char *sha1, const char **ignore);
 extern int has_sha1_file(const unsigned char *sha1);
-extern void *map_sha1_file(const unsigned char *sha1, unsigned long *);
 
 extern int has_pack_file(const unsigned char *sha1);
 extern int has_pack_index(const unsigned char *sha1);