Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
object: allow grow_object_hash to handle arbitrary repositories
author
Stefan Beller
<sbeller@google.com>
Tue, 8 May 2018 19:37:34 +0000
(12:37 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 9 May 2018 03:12:36 +0000
(12:12 +0900)
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
dd5d9de
)
diff --git
a/object.c
b/object.c
index a365a910859f74f69d7082d89bcd5b76ad263e14..0fcd6f6df42d73934c2fdeaabafd06c18bbbbcf9 100644
(file)
--- a/
object.c
+++ b/
object.c
@@
-116,27
+116,27
@@
struct object *lookup_object(const unsigned char *sha1)
* power of 2 (but at least 32). Copy the existing values to the new
* hash map.
*/
* power of 2 (but at least 32). Copy the existing values to the new
* hash map.
*/
-#define grow_object_hash(r) grow_object_hash_##r()
-static void grow_object_hash_the_repository(void)
+static void grow_object_hash(struct repository *r)
{
int i;
/*
* Note that this size must always be power-of-2 to match hash_obj
* above.
*/
{
int i;
/*
* Note that this size must always be power-of-2 to match hash_obj
* above.
*/
- int new_hash_size =
the_repository->parsed_objects->obj_hash_size < 32 ? 32 : 2 * the_repository
->parsed_objects->obj_hash_size;
+ int new_hash_size =
r->parsed_objects->obj_hash_size < 32 ? 32 : 2 * r
->parsed_objects->obj_hash_size;
struct object **new_hash;
new_hash = xcalloc(new_hash_size, sizeof(struct object *));
struct object **new_hash;
new_hash = xcalloc(new_hash_size, sizeof(struct object *));
- for (i = 0; i < the_repository->parsed_objects->obj_hash_size; i++) {
- struct object *obj = the_repository->parsed_objects->obj_hash[i];
+ for (i = 0; i < r->parsed_objects->obj_hash_size; i++) {
+ struct object *obj = r->parsed_objects->obj_hash[i];
+
if (!obj)
continue;
insert_obj_hash(obj, new_hash, new_hash_size);
}
if (!obj)
continue;
insert_obj_hash(obj, new_hash, new_hash_size);
}
- free(
the_repository
->parsed_objects->obj_hash);
-
the_repository
->parsed_objects->obj_hash = new_hash;
-
the_repository
->parsed_objects->obj_hash_size = new_hash_size;
+ free(
r
->parsed_objects->obj_hash);
+
r
->parsed_objects->obj_hash = new_hash;
+
r
->parsed_objects->obj_hash_size = new_hash_size;
}
void *create_object_the_repository(const unsigned char *sha1, void *o)
}
void *create_object_the_repository(const unsigned char *sha1, void *o)