Skip to content

Commit

Permalink
Revert "WIP: object-string cache string values"
Browse files Browse the repository at this point in the history
This reverts commit aef14c0542c7e42c21883960c2f57a57e480e27f.
  • Loading branch information
bazsi committed Jan 24, 2025
1 parent ada122d commit 885b9e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
7 changes: 2 additions & 5 deletions lib/filterx/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,9 @@ filterx_sources = \
BUILT_SOURCES += \
lib/filterx/filterx-grammar.y \
lib/filterx/filterx-grammar.c \
lib/filterx/filterx-grammar.h \
lib/filterx/cached-strings.h
lib/filterx/filterx-grammar.h

EXTRA_DIST += lib/filterx/filterx-grammar.ym \
lib/filterx/CMakeLists.txt \
lib/filterx/cached-strings.table \
lib/filterx/cached-strings.h
lib/filterx/CMakeLists.txt

include lib/filterx/tests/Makefile.am
15 changes: 0 additions & 15 deletions lib/filterx/object-string.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ enum
FX_STR_NUMBER7,
FX_STR_NUMBER8,
FX_STR_NUMBER9,
FX_STR_N_A,
FX_STR_0_0_0_0,
FX_STR_MAX,
};

#include "filterx/cached-strings.h"

static FilterXObject *string_cache[FX_STR_MAX];


Expand Down Expand Up @@ -201,15 +197,6 @@ filterx_string_new(const gchar *str, gssize str_len)
gint index = str[0] - '0';
return filterx_object_ref(string_cache[FX_STR_NUMBER0 + index]);
}
else if (str_len > 0 && str_len < 7)
{
const struct cached_string *cs = gperf_lookup_cached_string(str, str_len);

if (cs)
{
return filterx_object_ref(string_cache[cs->id]);
}
}
return &_string_new(str, str_len, NULL)->super;
}

Expand Down Expand Up @@ -421,8 +408,6 @@ filterx_string_global_init(void)
gchar number[2] = { i+'0', 0 };
filterx_cache_object(&string_cache[FX_STR_NUMBER0+i], &_string_new(number, 1, NULL)->super);
}
filterx_cache_object(&string_cache[FX_STR_N_A], &_string_new("N/A", -1, NULL)->super);
filterx_cache_object(&string_cache[FX_STR_0_0_0_0], &_string_new("0.0.0.0", -1, NULL)->super);
}

void
Expand Down

0 comments on commit 885b9e0

Please sign in to comment.