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>
This commit is contained in:
committed by
Junio C Hamano
parent
114a6a889f
commit
902bb36451
18
sha1-array.h
Normal file
18
sha1-array.h
Normal file
@ -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 */
|
||||
Reference in New Issue
Block a user