commit c6f826b4b8c649846845e38cd59168057e516ddc from: Stefan Sperling date: Sat Apr 13 16:08:40 2019 UTC better variable names in create_loose_object() commit - ac1c56620f5776671ec2b3e1b17ad82b05ad3dfb commit + c6f826b4b8c649846845e38cd59168057e516ddc blob - 35cbd8b8239ea074d03b5053e4750437a69e507d blob + e544db91b3594ed04379bbd7e1cebaf60e1ca246 --- lib/object_create.c +++ lib/object_create.c @@ -49,16 +49,16 @@ create_loose_object(struct got_object_id *id, FILE *co struct got_repository *repo) { const struct got_error *err = NULL, *unlock_err = NULL; - char *objpath = NULL, *outpath = NULL; - FILE *outfile = NULL; + char *objpath = NULL, *tmppath = NULL; + FILE *tmpfile = NULL; struct got_lockfile *lf = NULL; - size_t outlen = 0; + size_t tmplen = 0; err = got_object_get_path(&objpath, id, repo); if (err) return err; - err = got_opentemp_named(&outpath, &outfile, objpath); + err = got_opentemp_named(&tmppath, &tmpfile, objpath); if (err) { char *parent_path; if (!(err->code == GOT_ERR_ERRNO && errno == ENOENT)) @@ -70,12 +70,12 @@ create_loose_object(struct got_object_id *id, FILE *co free(parent_path); if (err) goto done; - err = got_opentemp_named(&outpath, &outfile, objpath); + err = got_opentemp_named(&tmppath, &tmpfile, objpath); if (err) goto done; } - err = got_deflate_to_file(&outlen, content, outfile); + err = got_deflate_to_file(&tmplen, content, tmpfile); if (err) goto done; @@ -83,12 +83,12 @@ create_loose_object(struct got_object_id *id, FILE *co if (err) goto done; - if (rename(outpath, objpath) != 0) { + if (rename(tmppath, objpath) != 0) { err = got_error_from_errno(); goto done; } - free(outpath); - outpath = NULL; + free(tmppath); + tmppath = NULL; if (chmod(objpath, GOT_DEFAULT_FILE_MODE) != 0) { err = got_error_from_errno(); @@ -96,12 +96,12 @@ create_loose_object(struct got_object_id *id, FILE *co } done: free(objpath); - if (outpath) { - if (unlink(outpath) != 0 && err == NULL) + if (tmppath) { + if (unlink(tmppath) != 0 && err == NULL) err = got_error_from_errno(); - free(outpath); + free(tmppath); } - if (outfile && fclose(outfile) != 0 && err == NULL) + if (tmpfile && fclose(tmpfile) != 0 && err == NULL) err = got_error_from_errno(); if (lf) unlock_err = got_lockfile_unlock(lf);