summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-10 10:20:03 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-10 10:20:03 +0000
commita56da0e3c95a55df0871b52e838862c87c83b886 (patch)
tree69603d5ae481701c33c3274ce96ee877313a46d5 /hash.c
parent8022634cf3496fdf405b323b7c0cb938f428fcb2 (diff)
downloadmandoc-a56da0e3c95a55df0871b52e838862c87c83b886.tar.gz
Fixed hash lookup regression.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index 98f1d4c7..ce0abe91 100644
--- a/hash.c
+++ b/hash.c
@@ -130,10 +130,13 @@ mdoc_tokhash_find(const void *arg, const char *tmp)
assert(0 == (size_t)slot % sizeof(struct mdoc_macro));
slot /= sizeof(struct mdoc_macro);
- if (0 == tmp[2])
- return(slot);
+ if (mdoc_macronames[slot][0] != tmp[0])
+ return(MDOC_MAX);
+ if (mdoc_macronames[slot][1] != tmp[1])
+ return(MDOC_MAX);
+ if (tmp[2] && mdoc_macronames[slot][2] != tmp[2])
+ return(MDOC_MAX);
- assert(0 == tmp[3]);
- return(tmp[2] == mdoc_macronames[slot][2] ? slot : MDOC_MAX);
+ return(slot);
}