tip_table.sorted = 1;
}
- found = sha1_pos(o->oid.hash, tip_table.table, tip_table.nr,
+ found = hash_pos(o->oid.hash, tip_table.table, tip_table.nr,
nth_tip_table_ent);
if (0 <= found)
return tip_table.table[found].refname;
if (!parent)
edge_value = GRAPH_PARENT_NONE;
else {
- edge_value = sha1_pos(parent->item->object.oid.hash,
+ edge_value = hash_pos(parent->item->object.oid.hash,
ctx->commits.list,
ctx->commits.nr,
commit_to_sha1);
else if (parent->next)
edge_value = GRAPH_EXTRA_EDGES_NEEDED | num_extra_edges;
else {
- edge_value = sha1_pos(parent->item->object.oid.hash,
+ edge_value = hash_pos(parent->item->object.oid.hash,
ctx->commits.list,
ctx->commits.nr,
commit_to_sha1);
/* Since num_parents > 2, this initializer is safe. */
for (parent = (*list)->parents->next; parent; parent = parent->next) {
- int edge_value = sha1_pos(parent->item->object.oid.hash,
+ int edge_value = hash_pos(parent->item->object.oid.hash,
ctx->commits.list,
ctx->commits.nr,
commit_to_sha1);
int commit_graft_pos(struct repository *r, const unsigned char *sha1)
{
- return sha1_pos(sha1, r->parsed_objects->grafts,
+ return hash_pos(sha1, r->parsed_objects->grafts,
r->parsed_objects->grafts_nr,
commit_graft_sha1_access);
}
int oid_array_lookup(struct oid_array *array, const struct object_id *oid)
{
oid_array_sort(array);
- return sha1_pos(oid->hash, array->oid, array->nr, sha1_access);
+ return hash_pos(oid->hash, array->oid, array->nr, sha1_access);
}
void oid_array_clear(struct oid_array *array)
struct bitmapped_commit *stored = &writer.selected[i];
int commit_pos =
- sha1_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
+ hash_pos(stored->commit->object.oid.hash, index, index_nr, sha1_access);
if (commit_pos < 0)
BUG("trying to write commit not in index");
if (get_sha1_hex(hex, hash))
return NULL; /* BUG */
- pos = sha1_pos(hash, rerere_dir, rerere_dir_nr, rerere_dir_hash);
+ pos = hash_pos(hash, rerere_dir, rerere_dir_nr, rerere_dir_hash);
if (pos < 0) {
rr_dir = xmalloc(sizeof(*rr_dir));
hashcpy(rr_dir->hash, hash);
*/
/*
* The table should contain "nr" elements.
- * The sha1 of element i (between 0 and nr - 1) should be returned
+ * The hash of element i (between 0 and nr - 1) should be returned
* by "fn(i, table)".
*/
-int sha1_pos(const unsigned char *hash, void *table, size_t nr,
- sha1_access_fn fn)
+int hash_pos(const unsigned char *hash, void *table, size_t nr,
+ hash_access_fn fn)
{
size_t hi = nr;
size_t lo = 0;
if (lov != hiv) {
/*
* At this point miv could be equal
- * to hiv (but sha1 could still be higher);
+ * to hiv (but hash could still be higher);
* the invariant of (mi < hi) should be
* kept.
*/
#ifndef SHA1_LOOKUP_H
#define SHA1_LOOKUP_H
-typedef const unsigned char *sha1_access_fn(size_t index, void *table);
+typedef const unsigned char *hash_access_fn(size_t index, void *table);
-int sha1_pos(const unsigned char *sha1,
+int hash_pos(const unsigned char *hash,
void *table,
size_t nr,
- sha1_access_fn fn);
+ hash_access_fn fn);
/*
* Searches for sha1 in table, using the given fanout table to determine the