Merge branch 'hn/typofix' into maint
[gitweb.git] / remote-testsvn.c
index 8e8d5c7947f815e143c1fd16ab4c0a23e17a02a3..0ff4a312629d4ed4250a076f39a9d78e76917158 100644 (file)
@@ -66,8 +66,7 @@ static char *read_ref_note(const struct object_id *oid)
        else if (!msglen || type != OBJ_BLOB) {
                error("Note contains unusable content. "
                        "Is something else using this notes tree? %s", notes_ref);
-               free(msg);
-               msg = NULL;
+               FREE_AND_NULL(msg);
        }
        free_notes(NULL);
        return msg;
@@ -124,10 +123,8 @@ static int note2mark_cb(const struct object_id *object_oid,
 static void regenerate_marks(void)
 {
        int ret;
-       FILE *marksfile = fopen(marksfilename, "w+");
+       FILE *marksfile = xfopen(marksfilename, "w+");
 
-       if (!marksfile)
-               die_errno("Couldn't create mark file %s.", marksfilename);
        ret = for_each_note(NULL, 0, note2mark_cb, marksfile);
        if (ret)
                die("Regeneration of marks failed, returned %d.", ret);
@@ -148,9 +145,7 @@ static void check_or_regenerate_marks(int latestrev)
        marksfile = fopen(marksfilename, "r");
        if (!marksfile) {
                regenerate_marks();
-               marksfile = fopen(marksfilename, "r");
-               if (!marksfile)
-                       die_errno("cannot read marks file %s!", marksfilename);
+               marksfile = xfopen(marksfilename, "r");
                fclose(marksfile);
        } else {
                strbuf_addf(&sb, ":%d ", latestrev);