diff options
Diffstat (limited to 'squark-filter.c')
-rw-r--r-- | squark-filter.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/squark-filter.c b/squark-filter.c index 8973d04..e47cbf5 100644 --- a/squark-filter.c +++ b/squark-filter.c @@ -112,12 +112,10 @@ static blob_t url_classify(struct url_info *url, struct sqdb *db) void *cmph; struct sqdb_index_entry *indx; uint32_t *categories; - char *strings; cmph_uint32 i = -1, previ; cmph = sqdb_section_get(db, SQDB_SECTION_INDEX_MPH, NULL); indx = sqdb_section_get(db, SQDB_SECTION_INDEX, NULL); - strings = sqdb_section_get(db, SQDB_SECTION_STRINGS, NULL); /* search for most qualified domain match; do first lookup * with two domain components */ @@ -132,14 +130,14 @@ static blob_t url_classify(struct url_info *url, struct sqdb *db) previ = i; i = cmph_search_packed(cmph, key.ptr, key.len); - if (blob_cmp(got, BLOB_STR(&strings[indx[i].component])) != 0) { + if (blob_cmp(got, sqdb_get_string_literal(db, indx[i].component)) != 0) { /* the subdomain did no longer match, use * parents classification */ i = previ; goto parent_dns_match; } if (!blob_is_null(tld)) { - if (blob_cmp(tld, BLOB_STR(&strings[indx[indx[i].parent].component])) != 0) { + if (blob_cmp(tld, sqdb_get_string_literal(db, indx[indx[i].parent].component)) != 0) { /* top level domain did not match */ i = -1; goto parent_dns_match; @@ -163,7 +161,7 @@ parent_dns_match: categories = sqdb_section_get(db, SQDB_SECTION_CATEGORIES, NULL); printf("%d\n", indx[i].category); - return BLOB_STR(&strings[categories[indx[i].category]]); + return sqdb_get_string_literal(db, categories[indx[i].category]); } int main(int argc, char **argv) |