rename fileindex functions from open/close to alloc/free
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/lib/fileindex.c b/lib/fileindex.c
index 1dfa96a..e860a4d 100644
--- a/lib/fileindex.c
+++ b/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 **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 *fileindex,
}
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);
diff --git a/lib/got_lib_fileindex.h b/lib/got_lib_fileindex.h
index d2a28dc..d0855be 100644
--- a/lib/got_lib_fileindex.h
+++ b/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 *);
diff --git a/lib/worktree.c b/lib/worktree.c
index 72e810d..e296ce1 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -418,7 +418,7 @@ add_file_on_disk(struct got_worktree *worktree, struct got_fileindex *fileindex,
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 *worktree,
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;