From: Eric Leblond Date: Fri, 10 May 2013 07:53:20 +0000 (+0200) Subject: suricata: function for lowercase table creation X-Git-Tag: suricata-2.0beta2~457 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42011e2d32c809ecc0655875da1c2dd4f4611f38;p=thirdparty%2Fsuricata.git suricata: function for lowercase table creation --- diff --git a/src/suricata.c b/src/suricata.c index 38129ae632..8127ed2540 100644 --- a/src/suricata.c +++ b/src/suricata.c @@ -289,6 +289,20 @@ uint8_t print_mem_flag = 1; #endif #endif +void CreateLowercaseTable() +{ + /* create table for O(1) lowercase conversion lookup. It was removed, but + * we still need it for cuda. So resintalling it back into the codebase */ + uint8_t c = 0; + memset(g_u8_lowercasetable, 0x00, sizeof(g_u8_lowercasetable)); + for ( ; c < 255; c++) { + if (c >= 'A' && c <= 'Z') + g_u8_lowercasetable[c] = (c + ('a' - 'A')); + else + g_u8_lowercasetable[c] = c; + } +} + void GlobalInits() { memset(trans_q, 0, sizeof(trans_q)); @@ -1617,16 +1631,7 @@ int main(int argc, char **argv) } } - /* create table for O(1) lowercase conversion lookup. It was removed, but - * we still need it for cuda. So resintalling it back into the codebase */ - uint8_t c = 0; - memset(g_u8_lowercasetable, 0x00, sizeof(g_u8_lowercasetable)); - for ( ; c < 255; c++) { - if (c >= 'A' && c <= 'Z') - g_u8_lowercasetable[c] = (c + ('a' - 'A')); - else - g_u8_lowercasetable[c] = c; - } + CreateLowercaseTable(); /* hardcoded initialization code */ SigTableSetup(); /* load the rule keywords */