commit 7426bbfd0325eb69b703734636662a9968c36888 from: Stefan Sperling date: Mon Dec 24 15:53:03 2018 UTC rename fileindex functions from open/close to alloc/free commit - 9eb6a6b2d1ab193449d90c240e14f2354b95a691 commit + 7426bbfd0325eb69b703734636662a9968c36888 blob - 1dfa96ad74652b87753d1297b40b7282b1b33c6a blob + e860a4dace549dfb77ad350dc3fce155b64dfdc1 --- lib/fileindex.c +++ lib/fileindex.c @@ -28,7 +28,7 @@ #include "got_lib_fileindex.h" const struct got_error * -got_fileindex_entry_open(struct got_fileindex_entry **entry, +got_fileindex_entry_alloc(struct got_fileindex_entry **entry, const char *ondisk_path, const char *relpath, uint8_t *blob_sha1) { struct stat sb; @@ -72,7 +72,7 @@ got_fileindex_entry_open(struct got_fileindex_entry ** } void -got_fileindex_entry_close(struct got_fileindex_entry *entry) +got_fileindex_entry_free(struct got_fileindex_entry *entry) { free(entry->path); free(entry); @@ -89,7 +89,7 @@ got_fileindex_entry_add(struct got_fileindex *fileinde } struct got_fileindex * -got_fileindex_open(void) +got_fileindex_alloc(void) { struct got_fileindex *fileindex; @@ -100,14 +100,14 @@ got_fileindex_open(void) } void -got_fileindex_close(struct got_fileindex *fileindex) +got_fileindex_free(struct got_fileindex *fileindex) { struct got_fileindex_entry *entry; while (!TAILQ_EMPTY(&fileindex->entries)) { entry = TAILQ_FIRST(&fileindex->entries); TAILQ_REMOVE(&fileindex->entries, entry, entry); - got_fileindex_entry_close(entry); + got_fileindex_entry_free(entry); fileindex->nentries--; } free(fileindex); blob - d2a28dc5c55f8c97f58908fa8b50512e9d57100f blob + d0855bedd7a7257124e3ec233a0cae2cb93b85ad --- lib/got_lib_fileindex.h +++ lib/got_lib_fileindex.h @@ -82,11 +82,11 @@ struct got_fileindex_hdr { uint8_t sha1[SHA1_DIGEST_LENGTH]; /* checksum of above on-disk data */ }; -const struct got_error *got_fileindex_entry_open(struct got_fileindex_entry **, +const struct got_error *got_fileindex_entry_alloc(struct got_fileindex_entry **, const char *, const char *, uint8_t *); -void got_fileindex_entry_close(struct got_fileindex_entry *); -struct got_fileindex *got_fileindex_open(void); -void got_fileindex_close(struct got_fileindex *); +void got_fileindex_entry_free(struct got_fileindex_entry *); +struct got_fileindex *got_fileindex_alloc(void); +void got_fileindex_free(struct got_fileindex *); const struct got_error *got_fileindex_write(struct got_fileindex *, FILE *); const struct got_error *got_fileindex_entry_add(struct got_fileindex *, struct got_fileindex_entry *); blob - 72e810d22ce253f7c807aceb768f59b3fc1aa5a4 blob + e296ce15039d8efc83bd172bc9a6abf87d3cbe13 --- lib/worktree.c +++ lib/worktree.c @@ -418,7 +418,7 @@ add_file_on_disk(struct got_worktree *worktree, struct fsync(fd); - err = got_fileindex_entry_open(&entry, ondisk_path, + err = got_fileindex_entry_alloc(&entry, ondisk_path, apply_path_prefix(worktree, path), blob->id.sha1); if (err) goto done; @@ -598,7 +598,7 @@ got_worktree_checkout_files(struct got_worktree *workt if (err) return err; - fileindex = got_fileindex_open(); + fileindex = got_fileindex_alloc(); if (fileindex == NULL) { err = got_error_from_errno(); goto done; @@ -678,7 +678,7 @@ done: fclose(new_index); free(new_fileindex_path); free(fileindex_path); - got_fileindex_close(fileindex); + got_fileindex_free(fileindex); unlockerr = lock_worktree(worktree, LOCK_SH); if (unlockerr && err == NULL) err = unlockerr;