Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Unify signedness in hashing calls
author
Dan McGee
<dpmcgee@gmail.com>
Tue, 19 May 2009 04:34:02 +0000
(23:34 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 20 May 2009 07:02:24 +0000
(
00:02
-0700)
Our hash_obj and hashtable_index calls and functions were doing a lot of
funny things with signedness. Unify all of it to 'unsigned int'.
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
decorate.c
patch
|
blob
|
history
object.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
99ddd24
)
diff --git
a/decorate.c
b/decorate.c
index e6fd8a7441a7ac6753d93e7156b9f71fe248262d..2f8a63e38881587fe29fcb72a5272ef54b9efa6e 100644
(file)
--- a/
decorate.c
+++ b/
decorate.c
@@
-18,7
+18,7
@@
static void *insert_decoration(struct decoration *n, const struct object *base,
{
int size = n->size;
struct object_decoration *hash = n->hash;
{
int size = n->size;
struct object_decoration *hash = n->hash;
- int j = hash_obj(base, size);
+
unsigned
int j = hash_obj(base, size);
while (hash[j].base) {
if (hash[j].base == base) {
while (hash[j].base) {
if (hash[j].base == base) {
@@
-70,7
+70,7
@@
void *add_decoration(struct decoration *n, const struct object *obj,
/* Lookup a decoration pointer */
void *lookup_decoration(struct decoration *n, const struct object *obj)
{
/* Lookup a decoration pointer */
void *lookup_decoration(struct decoration *n, const struct object *obj)
{
- int j;
+
unsigned
int j;
/* nothing to lookup */
if (!n->size)
/* nothing to lookup */
if (!n->size)
diff --git
a/object.c
b/object.c
index e1feef9c3329e0370e7caff612b4f6c8684cbaef..a6ef439192c1083e367f0a86cb10d93564fc9481 100644
(file)
--- a/
object.c
+++ b/
object.c
@@
-52,7
+52,7
@@
static unsigned int hash_obj(struct object *obj, unsigned int n)
static void insert_obj_hash(struct object *obj, struct object **hash, unsigned int size)
{
static void insert_obj_hash(struct object *obj, struct object **hash, unsigned int size)
{
- int j = hash_obj(obj, size);
+
unsigned
int j = hash_obj(obj, size);
while (hash[j]) {
j++;
while (hash[j]) {
j++;
@@
-62,16
+62,16
@@
static void insert_obj_hash(struct object *obj, struct object **hash, unsigned i
hash[j] = obj;
}
hash[j] = obj;
}
-static int hashtable_index(const unsigned char *sha1)
+static
unsigned
int hashtable_index(const unsigned char *sha1)
{
unsigned int i;
memcpy(&i, sha1, sizeof(unsigned int));
{
unsigned int i;
memcpy(&i, sha1, sizeof(unsigned int));
- return
(int)(i % obj_hash_size)
;
+ return
i % obj_hash_size
;
}
struct object *lookup_object(const unsigned char *sha1)
{
}
struct object *lookup_object(const unsigned char *sha1)
{
- int i;
+
unsigned
int i;
struct object *obj;
if (!obj_hash)
struct object *obj;
if (!obj_hash)