33 * data.
44 */
55
6- #define DISABLE_SIGN_COMPARE_WARNINGS
7-
86#include "git-compat-util.h"
97#include "object.h"
108#include "decorate.h"
@@ -16,17 +14,16 @@ static unsigned int hash_obj(const struct object *obj, unsigned int n)
1614
1715static void * insert_decoration (struct decoration * n , const struct object * base , void * decoration )
1816{
19- int size = n -> size ;
2017 struct decoration_entry * entries = n -> entries ;
21- unsigned int j = hash_obj (base , size );
18+ unsigned int j = hash_obj (base , n -> size );
2219
2320 while (entries [j ].base ) {
2421 if (entries [j ].base == base ) {
2522 void * old = entries [j ].decoration ;
2623 entries [j ].decoration = decoration ;
2724 return old ;
2825 }
29- if (++ j >= size )
26+ if (++ j >= n -> size )
3027 j = 0 ;
3128 }
3229 entries [j ].base = base ;
@@ -37,8 +34,8 @@ static void *insert_decoration(struct decoration *n, const struct object *base,
3734
3835static void grow_decoration (struct decoration * n )
3936{
40- int i ;
41- int old_size = n -> size ;
37+ unsigned int i ;
38+ unsigned int old_size = n -> size ;
4239 struct decoration_entry * old_entries = n -> entries ;
4340
4441 n -> size = (old_size + 1000 ) * 3 / 2 ;
@@ -59,9 +56,7 @@ static void grow_decoration(struct decoration *n)
5956void * add_decoration (struct decoration * n , const struct object * obj ,
6057 void * decoration )
6158{
62- int nr = n -> nr + 1 ;
63-
64- if (nr > n -> size * 2 / 3 )
59+ if ((n -> nr + 1 ) > n -> size * 2 / 3 )
6560 grow_decoration (n );
6661 return insert_decoration (n , obj , decoration );
6762}
0 commit comments