path: root/sha1-array.h
diff options
authorJeff King <>2011-05-19 21:34:33 (GMT)
committerJunio C Hamano <>2011-05-20 03:02:10 (GMT)
commit902bb3645160cae72fe43b5f7f5289968ac01617 (patch)
tree4e6d99ceee3eb20c0f6278211c00d040cd46ebd4 /sha1-array.h
parent114a6a889f5d21c26800c395a97cdd400073a9e8 (diff)
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 <>
Diffstat (limited to 'sha1-array.h')
1 files changed, 18 insertions, 0 deletions
diff --git a/sha1-array.h b/sha1-array.h
new file mode 100644
index 0000000..15d3b6b
--- /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 */