Skip to content

Commit 732134e

Browse files
mhaggergitster
authored andcommitted
free_ref_entry(): new function
Add a function free_ref_entry(). This function will become nontrivial when ref_entry (soon) becomes polymorphic. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5a4d494 commit 732134e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

refs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ static struct ref_entry *create_ref_entry(const char *refname,
145145
return ref;
146146
}
147147

148+
static void free_ref_entry(struct ref_entry *entry)
149+
{
150+
free(entry);
151+
}
152+
148153
/* Add a ref_entry to the end of the ref_array (unsorted). */
149154
static void add_ref(struct ref_array *refs, struct ref_entry *ref)
150155
{
@@ -156,7 +161,7 @@ static void clear_ref_array(struct ref_array *array)
156161
{
157162
int i;
158163
for (i = 0; i < array->nr; i++)
159-
free(array->refs[i]);
164+
free_ref_entry(array->refs[i]);
160165
free(array->refs);
161166
array->sorted = array->nr = array->alloc = 0;
162167
array->refs = NULL;
@@ -235,7 +240,7 @@ static void sort_ref_array(struct ref_array *array)
235240
i = 0;
236241
for (j = 1; j < array->nr; j++) {
237242
if (is_dup_ref(array->refs[i], array->refs[j])) {
238-
free(array->refs[j]);
243+
free_ref_entry(array->refs[j]);
239244
continue;
240245
}
241246
array->refs[++i] = array->refs[j];

0 commit comments

Comments
 (0)