Extract a function clear_cached_refs()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Aug 13, 2011 at 00:36 UTC f130b1168e95f51dcd6c7f3667b14bd244a9c61e
1 file changed +6 -3
refs.c
+6 -3
@@ -171,10 +171,8 @@ static void free_ref_list(struct ref_list *list)
171 }
172 }
173
174 -static void invalidate_cached_refs(void)
174 +static void clear_cached_refs(struct cached_refs *ca)
175 {
176 - struct cached_refs *ca = &cached_refs;
177 -
176 if (ca->did_loose && ca->loose)
177 free_ref_list(ca->loose);
178 if (ca->did_packed && ca->packed)
@@ -183,6 +181,11 @@ static void invalidate_cached_refs(void)
181 ca->did_loose = ca->did_packed = 0;
182 }
183
184 +static void invalidate_cached_refs(void)
185 +{
186 + clear_cached_refs(&cached_refs);
187 +}
188 +
189 static void read_packed_refs(FILE *f, struct cached_refs *cached_refs)
190 {
191 struct ref_list *list = NULL;