From b8ff91831829221d57944eafca28cf6420485061 Mon Sep 17 00:00:00 2001 From: Chang Song Date: Fri, 30 Oct 2009 17:08:49 +0100 Subject: [PATCH] Ignore stats prefix for keys without prefix delimiter --- stats.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/stats.c b/stats.c index dc6dcf4f3a..5e6b0406c1 100644 --- a/stats.c +++ b/stats.c @@ -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;