From 1e657b6c6d3c9760a1bd9828f7d28329242ee85f Mon Sep 17 00:00:00 2001 From: James Clark Date: Tue, 24 Nov 1998 07:33:01 +0000 Subject: [PATCH] XML_UNICODE_WCHAR_T implies XML_UNICODE Define keyeq --- expat/xmlparse/hashtable.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/expat/xmlparse/hashtable.c b/expat/xmlparse/hashtable.c index 2876975b..7dddc40c 100755 --- a/expat/xmlparse/hashtable.c +++ b/expat/xmlparse/hashtable.c @@ -22,16 +22,26 @@ Contributor(s): #include #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)