From 902bb3645160cae72fe43b5f7f5289968ac01617 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 19 May 2011 17:34:33 -0400 Subject: bisect: refactor sha1_array into a generic sha1 list This is a generally useful abstraction, so let's let others make use of it. The refactoring is more or less a straight copy; however, functions and struct members have had their names changed to match string_list, which is the most similar data structure. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- sha1-array.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 sha1-array.h (limited to 'sha1-array.h') diff --git a/sha1-array.h b/sha1-array.h new file mode 100644 index 000000000..15d3b6b98 --- /dev/null +++ b/sha1-array.h @@ -0,0 +1,18 @@ +#ifndef SHA1_ARRAY_H +#define SHA1_ARRAY_H + +struct sha1_array { + unsigned char (*sha1)[20]; + int nr; + int alloc; + int sorted; +}; + +#define SHA1_ARRAY_INIT { NULL, 0, 0, 0 } + +void sha1_array_append(struct sha1_array *array, const unsigned char *sha1); +void sha1_array_sort(struct sha1_array *array); +int sha1_array_lookup(struct sha1_array *array, const unsigned char *sha1); +void sha1_array_clear(struct sha1_array *array); + +#endif /* SHA1_ARRAY_H */ -- cgit v1.2.1