Commit da885ca1 authored by Geoff Simmons's avatar Geoff Simmons

Speed up prefix matches a bit.

parent 47eae6cd
...@@ -275,7 +275,8 @@ pt_search(const struct pt_y * const restrict y, ...@@ -275,7 +275,8 @@ pt_search(const struct pt_y * const restrict y,
l = y->off + y->len; l = y->off + y->len;
if (l > len) if (l > len)
return (0); return (0);
if (memcmp(subject + y->off, strings[y->idx] + y->off, y->len) != 0) if (y->len > 0
&& memcmp(subject + y->off, strings[y->idx] + y->off, y->len) != 0)
return (0); return (0);
if (strings[y->idx][l] == '\0') { if (strings[y->idx][l] == '\0') {
......
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