reader: free is unused and unnecessary None of the reader implementations actually allocate anything themselves, so they don't need a free function. Remove it.
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
diff --git a/src/reader.c b/src/reader.c
index 2cdd0a1..5de731b 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -47,11 +47,6 @@ done:
return error;
}
-static void tree_reader_free(git_reader *_reader)
-{
- GIT_UNUSED(_reader);
-}
-
int git_reader_for_tree(git_reader **out, git_tree *tree)
{
tree_reader *reader;
@@ -62,7 +57,6 @@ int git_reader_for_tree(git_reader **out, git_tree *tree)
GITERR_CHECK_ALLOC(reader);
reader->reader.read = tree_reader_read;
- reader->reader.free = tree_reader_free;
reader->tree = tree;
*out = (git_reader *)reader;
@@ -129,11 +123,6 @@ done:
return error;
}
-static void workdir_reader_free(git_reader *_reader)
-{
- GIT_UNUSED(_reader);
-}
-
int git_reader_for_workdir(
git_reader **out,
git_repository *repo,
@@ -148,7 +137,6 @@ int git_reader_for_workdir(
GITERR_CHECK_ALLOC(reader);
reader->reader.read = workdir_reader_read;
- reader->reader.free = workdir_reader_free;
reader->repo = repo;
if (validate_index &&
@@ -196,11 +184,6 @@ done:
return error;
}
-static void index_reader_free(git_reader *_reader)
-{
- GIT_UNUSED(_reader);
-}
-
int git_reader_for_index(
git_reader **out,
git_repository *repo,
@@ -215,7 +198,6 @@ int git_reader_for_index(
GITERR_CHECK_ALLOC(reader);
reader->reader.read = index_reader_read;
- reader->reader.free = index_reader_free;
reader->repo = repo;
if (index) {
@@ -247,6 +229,5 @@ void git_reader_free(git_reader *reader)
if (!reader)
return;
- reader->free(reader);
git__free(reader);
}
diff --git a/src/reader.h b/src/reader.h
index e1d9068..f9dd6b5 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -26,7 +26,6 @@ typedef struct git_reader git_reader;
*/
struct git_reader {
int (*read)(git_buf *out, git_oid *out_oid, git_reader *reader, const char *filename);
- void (*free)(git_reader *reader);
};
/**