XML_UNICODE_WCHAR_T implies XML_UNICODE
Define keyeq
This commit is contained in:
parent
2967177479
commit
1e657b6c6d
@ -22,16 +22,26 @@ Contributor(s):
|
||||
#include <string.h>
|
||||
|
||||
#include "xmldef.h"
|
||||
#include "hashtable.h"
|
||||
|
||||
#ifdef XML_UNICODE
|
||||
#define keycmp wcscmp
|
||||
#else
|
||||
#define keycmp strcmp
|
||||
#ifdef XML_UNICODE_WCHAR_T
|
||||
#ifndef XML_UNICODE
|
||||
#define XML_UNICODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#define INIT_SIZE 64
|
||||
|
||||
static
|
||||
int keyeq(const XML_Char *s1, const XML_Char *s2)
|
||||
{
|
||||
for (; *s1 == *s2; s1++, s2++)
|
||||
if (*s1 == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
unsigned long hash(KEY s)
|
||||
{
|
||||
@ -59,7 +69,7 @@ NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize)
|
||||
for (i = h & (table->size - 1);
|
||||
table->v[i];
|
||||
i == 0 ? i = table->size - 1 : --i) {
|
||||
if (keycmp(name, table->v[i]->name) == 0)
|
||||
if (keyeq(name, table->v[i]->name))
|
||||
return table->v[i];
|
||||
}
|
||||
if (!createSize)
|
||||
|
Loading…
Reference in New Issue
Block a user