coccinelle: polish FREE_AND_NULL rules
[gitweb.git] / fast-import.c
index e69d219682e7929b6e8441ba620e708704471ff3..eeab927d5ab9f8bca61e68ef3fe29b565a11fdc1 100644 (file)
@@ -1063,8 +1063,7 @@ static void end_packfile(void)
                close(pack_data->pack_fd);
                unlink_or_warn(pack_data->pack_name);
        }
-       free(pack_data);
-       pack_data = NULL;
+       FREE_AND_NULL(pack_data);
        running = 0;
 
        /* We can't carry a delta across packfiles. */
@@ -1149,8 +1148,7 @@ static int store_object(
 
                /* We cannot carry a delta into the new pack. */
                if (delta) {
-                       free(delta);
-                       delta = NULL;
+                       FREE_AND_NULL(delta);
 
                        git_deflate_init(&s, pack_compression_level);
                        s.next_in = (void *)dat->buf;
@@ -3285,9 +3283,7 @@ static void option_export_pack_edges(const char *edges)
 {
        if (pack_edges)
                fclose(pack_edges);
-       pack_edges = fopen(edges, "a");
-       if (!pack_edges)
-               die_errno("Cannot open '%s'", edges);
+       pack_edges = xfopen(edges, "a");
 }
 
 static int parse_one_option(const char *option)