diff options
author | Jeff King <peff@peff.net> | 2018-04-06 21:59:45 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-09 00:14:46 +0300 |
commit | 427cbc9dbfeb7c96bb1d5d9ace722353e2a5438e (patch) | |
tree | 744ac05e882b68aefcaabc345a28672effb08c12 /ref-filter.h | |
parent | 0ffaa00f453978bffc4ff0f8a45ea0a52549e7cd (diff) |
ref-filter: factor ref_array pushing into its own function
In preparation for callers constructing their own ref_array
structs, let's move our own internal push operation into its
own function.
While we're at it, we can replace REALLOC_ARRAY() with
ALLOC_GROW(), which should give the growth operation
amortized linear complexity (as opposed to growing by one,
which is potentially quadratic, though in-place realloc
growth often makes this faster in practice).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.h')
-rw-r--r-- | ref-filter.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ref-filter.h b/ref-filter.h index 68268f9ebc..76cf87cb6c 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -135,4 +135,12 @@ void setup_ref_filter_porcelain_msg(void); void pretty_print_ref(const char *name, const struct object_id *oid, const struct ref_format *format); +/* + * Push a single ref onto the array; this can be used to construct your own + * ref_array without using filter_refs(). + */ +struct ref_array_item *ref_array_push(struct ref_array *array, + const char *refname, + const struct object_id *oid); + #endif /* REF_FILTER_H */ |