@@ -14,20 +14,20 @@ static unsigned int hash_obj(const struct object *obj, unsigned int n)
1414static void * insert_decoration (struct decoration * n , const struct object * base , void * decoration )
1515{
1616 int size = n -> size ;
17- struct object_decoration * hash = n -> hash ;
17+ struct decoration_entry * entries = n -> entries ;
1818 unsigned int j = hash_obj (base , size );
1919
20- while (hash [j ].base ) {
21- if (hash [j ].base == base ) {
22- void * old = hash [j ].decoration ;
23- hash [j ].decoration = decoration ;
20+ while (entries [j ].base ) {
21+ if (entries [j ].base == base ) {
22+ void * old = entries [j ].decoration ;
23+ entries [j ].decoration = decoration ;
2424 return old ;
2525 }
2626 if (++ j >= size )
2727 j = 0 ;
2828 }
29- hash [j ].base = base ;
30- hash [j ].decoration = decoration ;
29+ entries [j ].base = base ;
30+ entries [j ].decoration = decoration ;
3131 n -> nr ++ ;
3232 return NULL ;
3333}
@@ -36,24 +36,23 @@ static void grow_decoration(struct decoration *n)
3636{
3737 int i ;
3838 int old_size = n -> size ;
39- struct object_decoration * old_hash = n -> hash ;
39+ struct decoration_entry * old_entries = n -> entries ;
4040
4141 n -> size = (old_size + 1000 ) * 3 / 2 ;
42- n -> hash = xcalloc (n -> size , sizeof (struct object_decoration ));
42+ n -> entries = xcalloc (n -> size , sizeof (struct decoration_entry ));
4343 n -> nr = 0 ;
4444
4545 for (i = 0 ; i < old_size ; i ++ ) {
46- const struct object * base = old_hash [i ].base ;
47- void * decoration = old_hash [i ].decoration ;
46+ const struct object * base = old_entries [i ].base ;
47+ void * decoration = old_entries [i ].decoration ;
4848
4949 if (!decoration )
5050 continue ;
5151 insert_decoration (n , base , decoration );
5252 }
53- free (old_hash );
53+ free (old_entries );
5454}
5555
56- /* Add a decoration pointer, return any old one */
5756void * add_decoration (struct decoration * n , const struct object * obj ,
5857 void * decoration )
5958{
@@ -64,7 +63,6 @@ void *add_decoration(struct decoration *n, const struct object *obj,
6463 return insert_decoration (n , obj , decoration );
6564}
6665
67- /* Lookup a decoration pointer */
6866void * lookup_decoration (struct decoration * n , const struct object * obj )
6967{
7068 unsigned int j ;
@@ -74,7 +72,7 @@ void *lookup_decoration(struct decoration *n, const struct object *obj)
7472 return NULL ;
7573 j = hash_obj (obj , n -> size );
7674 for (;;) {
77- struct object_decoration * ref = n -> hash + j ;
75+ struct decoration_entry * ref = n -> entries + j ;
7876 if (ref -> base == obj )
7977 return ref -> decoration ;
8078 if (!ref -> base )
0 commit comments