Skip to content

Commit

Permalink
Ignore stats prefix for keys without prefix delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
Chang Song authored and Trond Norbye committed Oct 30, 2009
1 parent b1001be commit b8ff918
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,20 @@ static PREFIX_STATS *stats_prefix_find(const char *key, const size_t nkey) {
PREFIX_STATS *pfs;
uint32_t hashval;
size_t length;
bool bailout = true;

assert(key != NULL);

for (length = 0; length < nkey && key[length] != '\0'; length++)
if (key[length] == settings.prefix_delimiter)
for (length = 0; length < nkey && key[length] != '\0'; length++) {
if (key[length] == settings.prefix_delimiter) {
bailout = false;
break;
}
}

if (bailout) {
return NULL;
}

hashval = hash(key, length, 0) % PREFIX_HASH_SIZE;

Expand Down

0 comments on commit b8ff918

Please sign in to comment.