Commit f002aec1 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

riched20: Avoid an ARRAY_SIZE-like macro.

parent 381012f7
...@@ -2175,14 +2175,13 @@ static RTFKey rtfKey[] = ...@@ -2175,14 +2175,13 @@ static RTFKey rtfKey[] =
{ 0, -1, NULL, 0 } { 0, -1, NULL, 0 }
}; };
#define RTF_KEY_COUNT (sizeof(rtfKey) / sizeof(RTFKey))
typedef struct tagRTFHashTableEntry { typedef struct tagRTFHashTableEntry {
int count; int count;
RTFKey **value; RTFKey **value;
} RTFHashTableEntry; } RTFHashTableEntry;
static RTFHashTableEntry rtfHashTable[RTF_KEY_COUNT * 2]; static RTFHashTableEntry rtfHashTable[ARRAY_SIZE(rtfKey) * 2];
/* /*
...@@ -2199,7 +2198,7 @@ void LookupInit(void) ...@@ -2199,7 +2198,7 @@ void LookupInit(void)
int index; int index;
rp->rtfKHash = Hash (rp->rtfKStr); rp->rtfKHash = Hash (rp->rtfKStr);
index = rp->rtfKHash % (RTF_KEY_COUNT * 2); index = rp->rtfKHash % (ARRAY_SIZE(rtfKey) * 2);
if (!rtfHashTable[index].count) if (!rtfHashTable[index].count)
rtfHashTable[index].value = heap_alloc(sizeof(RTFKey *)); rtfHashTable[index].value = heap_alloc(sizeof(RTFKey *));
else else
...@@ -2212,7 +2211,7 @@ void LookupCleanup(void) ...@@ -2212,7 +2211,7 @@ void LookupCleanup(void)
{ {
unsigned int i; unsigned int i;
for (i=0; i<RTF_KEY_COUNT*2; i++) for (i = 0; i < ARRAY_SIZE(rtfKey) * 2; i++)
{ {
heap_free( rtfHashTable[i].value ); heap_free( rtfHashTable[i].value );
rtfHashTable[i].value = NULL; rtfHashTable[i].value = NULL;
...@@ -2235,7 +2234,7 @@ static void Lookup(RTF_Info *info, char *s) ...@@ -2235,7 +2234,7 @@ static void Lookup(RTF_Info *info, char *s)
++s; /* skip over the leading \ character */ ++s; /* skip over the leading \ character */
hash = Hash (s); hash = Hash (s);
entry = &rtfHashTable[hash % (RTF_KEY_COUNT * 2)]; entry = &rtfHashTable[hash % (ARRAY_SIZE(rtfKey) * 2)];
for (i = 0; i < entry->count; i++) for (i = 0; i < entry->count; i++)
{ {
rp = entry->value[i]; rp = entry->value[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment