summaryrefslogtreecommitdiff
path: root/labels.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-16 17:57:25 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-16 18:04:57 -0700
commit97a234782d6fa7fa551a27f2ede452f5a56f1745 (patch)
treee937544cbdb0ac1368b587df71b94d3169726207 /labels.c
parentd2fb7a699ea8eb953313eead23180986a424271e (diff)
downloadnasm-97a234782d6fa7fa551a27f2ede452f5a56f1745.tar.gz
nasm-97a234782d6fa7fa551a27f2ede452f5a56f1745.tar.bz2
nasm-97a234782d6fa7fa551a27f2ede452f5a56f1745.zip
Switch the preprocessor over to using the hash table library
Switch the preprocessor over to using the hash table library. On my system, this improves the runtime of the output of test/pref/macro.pl from over 600 seconds to 7 seconds. Macros have an odd mix of case-sensitive and case-insensitive behaviour, plus there are matching parameters for arguments, etc. As a result, we use case-insensitive hash tables and use a linked list to store all the possible isomorphs.
Diffstat (limited to 'labels.c')
-rw-r--r--labels.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/labels.c b/labels.c
index ae2cbb8..5a1fd13 100644
--- a/labels.c
+++ b/labels.c
@@ -100,7 +100,7 @@ static union label *find_label(char *label, int create)
{
char *prev;
int prevlen, len;
- union label *lptr;
+ union label *lptr, **lpp;
char label_str[IDLEN_MAX];
struct hash_insert ip;
@@ -118,7 +118,8 @@ static union label *find_label(char *label, int create)
prevlen = 0;
}
- lptr = hash_find(ltab, label, &ip);
+ lpp = (union label **) hash_find(ltab, label, &ip);
+ lptr = lpp ? *lpp : NULL;
if (lptr || !create)
return lptr;