diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-14 23:16:17 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-10-02 22:16:06 -0700 |
commit | 510c5429e4c2e2f4d8752e688e9fbc008523774d (patch) | |
tree | 53ce30389d040df47d533fd802fc349d95647ba4 /table11.c | |
parent | e1e857744290f0a09d60435e8d5997efb0a436ba (diff) |
Convert ValueRec structures from unsigned long to uint32_t values
Used for GC struct members, which are defined in the protocol as 32-bit,
so no need to waste time and memory copying into 64-bit longs everywhere
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'table11.c')
-rw-r--r-- | table11.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -128,7 +128,7 @@ ValuePtr buckets[HASH_SIZE]; #define HASH(key) ((key) % HASH_SIZE) ValuePtr -GetValueRec(unsigned long key) +GetValueRec(uint32_t key) { ValuePtr *bucket, value; @@ -141,16 +141,16 @@ GetValueRec(unsigned long key) } void -CreateValueRec(unsigned long key, int size, const unsigned long *def) +CreateValueRec(uint32_t key, int size, const uint32_t *def) { ValuePtr *bucket, value; int i; bucket = &buckets[HASH(key)]; - value = malloc(sizeof(ValueRec) + (size * sizeof(unsigned long))); + value = malloc(sizeof(ValueRec) + (size * sizeof(uint32_t))); if (!value) return; - value->values = (unsigned long *) (value + 1); + value->values = (uint32_t *) (value + 1); for (i = 0; i < size; i++) value->values[i] = ILong((const unsigned char *) (def + i)); value->size = size; @@ -160,7 +160,7 @@ CreateValueRec(unsigned long key, int size, const unsigned long *def) } void -DeleteValueRec(unsigned long key) +DeleteValueRec(uint32_t key) { ValuePtr *bucket, value; @@ -175,11 +175,11 @@ DeleteValueRec(unsigned long key) } void -SetValueRec(unsigned long key, +SetValueRec(uint32_t key, const unsigned char *control, short clength, short ctype, const unsigned char *values) { - long cmask; + uint32_t cmask; struct ValueListEntry *p; ValuePtr value; int i; @@ -202,7 +202,7 @@ SetValueRec(unsigned long key, /* the ctype is a set type, so this code is similar to PrintSET */ for (p = TD[ctype].ValueList, i = 0; p != NULL; p = p->Next, i++) { if ((p->Value & cmask) != 0) { - memcpy(&value->values[i], values, sizeof(unsigned long)); + memcpy(&value->values[i], values, sizeof(uint32_t)); values += 4; } } |