Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
free_ref_entry(): new function
author
Michael Haggerty
<mhagger@alum.mit.edu>
Tue, 10 Apr 2012 05:30:21 +0000
(07:30 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 10 Apr 2012 22:54:58 +0000
(15:54 -0700)
Add a function free_ref_entry(). This function will become nontrivial
when ref_entry (soon) becomes polymorphic.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
5a4d494
)
diff --git
a/refs.c
b/refs.c
index 4b94b08dbfeb2408ceea14cd4e4b846764a68325..8659c3eff70d30e4ddf7b068faef563703bff886 100644
(file)
--- a/
refs.c
+++ b/
refs.c
@@
-145,6
+145,11
@@
static struct ref_entry *create_ref_entry(const char *refname,
return ref;
}
return ref;
}
+static void free_ref_entry(struct ref_entry *entry)
+{
+ free(entry);
+}
+
/* Add a ref_entry to the end of the ref_array (unsorted). */
static void add_ref(struct ref_array *refs, struct ref_entry *ref)
{
/* Add a ref_entry to the end of the ref_array (unsorted). */
static void add_ref(struct ref_array *refs, struct ref_entry *ref)
{
@@
-156,7
+161,7
@@
static void clear_ref_array(struct ref_array *array)
{
int i;
for (i = 0; i < array->nr; i++)
{
int i;
for (i = 0; i < array->nr; i++)
- free(array->refs[i]);
+ free
_ref_entry
(array->refs[i]);
free(array->refs);
array->sorted = array->nr = array->alloc = 0;
array->refs = NULL;
free(array->refs);
array->sorted = array->nr = array->alloc = 0;
array->refs = NULL;
@@
-235,7
+240,7
@@
static void sort_ref_array(struct ref_array *array)
i = 0;
for (j = 1; j < array->nr; j++) {
if (is_dup_ref(array->refs[i], array->refs[j])) {
i = 0;
for (j = 1; j < array->nr; j++) {
if (is_dup_ref(array->refs[i], array->refs[j])) {
- free(array->refs[j]);
+ free
_ref_entry
(array->refs[j]);
continue;
}
array->refs[++i] = array->refs[j];
continue;
}
array->refs[++i] = array->refs[j];