summaryrefslogtreecommitdiff
path: root/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/hash.h b/hash.h
index b875ce67c4..1d43ac0ba0 100644
--- a/hash.h
+++ b/hash.h
@@ -40,4 +40,11 @@ static inline void init_hash(struct hash_table *table)
table->array = NULL;
}
+static inline void preallocate_hash(struct hash_table *table, unsigned int elts)
+{
+ assert(table->size == 0 && table->nr == 0 && table->array == NULL);
+ table->size = elts * 2;
+ table->array = xcalloc(sizeof(struct hash_table_entry), table->size);
+}
+
#endif