]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
classtype: small memory reduction
authorVictor Julien <victor@inliniac.net>
Tue, 1 Oct 2019 10:07:05 +0000 (12:07 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 8 Oct 2019 18:31:09 +0000 (20:31 +0200)
Reduce memory use by making sure SCClassConfClasstype
has a more optimal memory layout.

src/util-classification-config.c
src/util-classification-config.h

index 2b026d25cafe87ec26dac02c74ed599ea231a6ad..a59624af6f37dec1930719a7d292a22cd624a93f 100644 (file)
@@ -574,7 +574,7 @@ SCClassConfClasstype *SCClassConfGetClasstype(const char *ct_name,
         name[s] = tolower((unsigned char)ct_name[s]);
     name[s] = '\0';
 
-    SCClassConfClasstype ct_lookup = {0, name, NULL, 0 };
+    SCClassConfClasstype ct_lookup = {0, 0, name, NULL };
     SCClassConfClasstype *lookup_ct_info = HashTableLookup(de_ctx->class_conf_ht,
                                                            &ct_lookup, 0);
     return lookup_ct_info;
index 57d76b95dcefc2aff244402608beb7835de3d8a3..e35e992e18f8d518751d591b93b7a0b565c17094 100644 (file)
@@ -31,15 +31,15 @@ typedef struct SCClassConfClasstype_ {
     /* The index of the classification within classification.confg */
     uint8_t classtype_id;
 
+    /* The priority this classification type carries */
+    int priority;
+
     /* The classtype name.  This is the primary key for a Classification. */
     char *classtype;
 
     /* Description for a classification.  Would be used while printing out
      * the classification info for a Signature, by the fast-log module. */
     char *classtype_desc;
-
-    /* The priority this classification type carries */
-    int priority;
 } SCClassConfClasstype;
 
 void SCClassConfLoadClassficationConfigFile(DetectEngineCtx *, FILE *fd);