ref-filter: provide a function for parsing sort options
[gitweb.git] / builtin / pack-objects.c
index f672225def033595602bc4ff91ee26edd9804944..f4a8441fe913850e7a1cadf3376837237519e761 100644 (file)
@@ -1,5 +1,6 @@
 #include "builtin.h"
 #include "cache.h"
+#include "config.h"
 #include "attr.h"
 #include "object.h"
 #include "blob.h"
@@ -264,8 +265,7 @@ static unsigned long write_no_reuse_object(struct sha1file *f, struct object_ent
                 * make sure no cached delta data remains from a
                 * previous attempt before a pack split occurred.
                 */
-               free(entry->delta_data);
-               entry->delta_data = NULL;
+               FREE_AND_NULL(entry->delta_data);
                entry->z_delta_size = 0;
        } else if (entry->delta_data) {
                size = entry->delta_size;
@@ -1375,12 +1375,10 @@ static void cleanup_preferred_base(void)
                if (!pbase_tree_cache[i])
                        continue;
                free(pbase_tree_cache[i]->tree_data);
-               free(pbase_tree_cache[i]);
-               pbase_tree_cache[i] = NULL;
+               FREE_AND_NULL(pbase_tree_cache[i]);
        }
 
-       free(done_pbase_paths);
-       done_pbase_paths = NULL;
+       FREE_AND_NULL(done_pbase_paths);
        done_pbase_paths_num = done_pbase_paths_alloc = 0;
 }
 
@@ -1970,8 +1968,7 @@ static unsigned long free_unpacked(struct unpacked *n)
        n->index = NULL;
        if (n->data) {
                freed_mem += n->entry->size;
-               free(n->data);
-               n->data = NULL;
+               FREE_AND_NULL(n->data);
        }
        n->entry = NULL;
        n->depth = 0;