From 94bf73c6b4c2b8a6fe0ce5b89465be570a7f6e1c Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Mon, 11 Sep 2000 03:25:49 +0000 Subject: [PATCH] Small cleanup. committer: mfx 968642749 +0000 --- src/filter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/filter.cpp b/src/filter.cpp index f9e79bed..e8a9266f 100644 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -55,11 +55,13 @@ const FilterImp::FilterEntry *FilterImp::getFilter(int id) if (!done) { // init the filter_map[] + assert(n_filters <= 254); // as 0xff means "empty slot" memset(filter_map, 0xff, sizeof(filter_map)); for (int i = 0; i < n_filters; i++) { int fid = filters[i].id; assert(fid >= 0 && fid <= 255); + assert(filter_map[fid] == 0xff); filter_map[fid] = (unsigned char) i; } done = true; @@ -68,7 +70,7 @@ const FilterImp::FilterEntry *FilterImp::getFilter(int id) if (id < 0 || id > 255) return NULL; unsigned index = filter_map[id]; - if (index == 0xff) + if (index == 0xff) // empty slot return NULL; assert(filters[index].id == id); return &filters[index];