]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
suricata: function for lowercase table creation
authorEric Leblond <eric@regit.org>
Fri, 10 May 2013 07:53:20 +0000 (09:53 +0200)
committerEric Leblond <eric@regit.org>
Mon, 29 Jul 2013 12:33:42 +0000 (14:33 +0200)
src/suricata.c

index 38129ae63274bc5b33a53de2d9752df751d2468d..8127ed25400a42c62064470e6b297aa1aaf82492 100644 (file)
@@ -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 */