3
3
* data.
4
4
*/
5
5
6
- #define DISABLE_SIGN_COMPARE_WARNINGS
7
-
8
6
#include "git-compat-util.h"
9
7
#include "object.h"
10
8
#include "decorate.h"
@@ -16,17 +14,16 @@ static unsigned int hash_obj(const struct object *obj, unsigned int n)
16
14
17
15
static void * insert_decoration (struct decoration * n , const struct object * base , void * decoration )
18
16
{
19
- int size = n -> size ;
20
17
struct decoration_entry * entries = n -> entries ;
21
- unsigned int j = hash_obj (base , size );
18
+ unsigned int j = hash_obj (base , n -> size );
22
19
23
20
while (entries [j ].base ) {
24
21
if (entries [j ].base == base ) {
25
22
void * old = entries [j ].decoration ;
26
23
entries [j ].decoration = decoration ;
27
24
return old ;
28
25
}
29
- if (++ j >= size )
26
+ if (++ j >= n -> size )
30
27
j = 0 ;
31
28
}
32
29
entries [j ].base = base ;
@@ -37,8 +34,8 @@ static void *insert_decoration(struct decoration *n, const struct object *base,
37
34
38
35
static void grow_decoration (struct decoration * n )
39
36
{
40
- int i ;
41
- int old_size = n -> size ;
37
+ unsigned int i ;
38
+ unsigned int old_size = n -> size ;
42
39
struct decoration_entry * old_entries = n -> entries ;
43
40
44
41
n -> size = (old_size + 1000 ) * 3 / 2 ;
@@ -59,9 +56,7 @@ static void grow_decoration(struct decoration *n)
59
56
void * add_decoration (struct decoration * n , const struct object * obj ,
60
57
void * decoration )
61
58
{
62
- int nr = n -> nr + 1 ;
63
-
64
- if (nr > n -> size * 2 / 3 )
59
+ if ((n -> nr + 1 ) > n -> size * 2 / 3 )
65
60
grow_decoration (n );
66
61
return insert_decoration (n , obj , decoration );
67
62
}
0 commit comments