diff options
author | Jeff King <peff@peff.net> | 2011-05-19 17:34:33 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-19 20:02:10 -0700 |
commit | 902bb3645160cae72fe43b5f7f5289968ac01617 (patch) | |
tree | 4e6d99ceee3eb20c0f6278211c00d040cd46ebd4 /sha1-array.h | |
parent | 114a6a889f5d21c26800c395a97cdd400073a9e8 (diff) | |
download | git-902bb3645160cae72fe43b5f7f5289968ac01617.tar.gz |
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1-array.h')
-rw-r--r-- | sha1-array.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sha1-array.h b/sha1-array.h new file mode 100644 index 0000000000..15d3b6b984 --- /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 */ |