]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix clang warning
authorKen Steele <ken@tilera.com>
Tue, 30 Sep 2014 17:04:27 +0000 (13:04 -0400)
committerVictor Julien <victor@inliniac.net>
Thu, 15 Jan 2015 10:52:03 +0000 (11:52 +0100)
Clang doesn't seem to like defining a function within a function.

src/detect.c

index 6b7537a7db3efccf4c1a4b674385e516abc0c99f..430986aea78fb2bbfe189a724a61b0d40806a8c9 100644 (file)
@@ -837,6 +837,13 @@ static inline void DetectPrefilterMergeSort(DetectEngineCtx *de_ctx,
     BUG_ON((det_ctx->pmq.rule_id_array_cnt + sgh->non_mpm_id_cnt) < det_ctx->match_array_cnt);
 }
 
+static int DoSort(const void *a, const void *b)
+{
+    uint32_t x = *(uint32_t *)a;
+    uint32_t y = *(uint32_t *)b;
+    return x - y;
+}
+
 #define SMS_USE_FLOW_SGH        0x01
 #define SMS_USED_PM             0x02
 #define SMS_USED_STREAM_PM      0x04
@@ -1087,11 +1094,6 @@ static inline void DetectMpmPrefilter(DetectEngineCtx *de_ctx,
     /* Sort the rule list to lets look at pmq.
      * NOTE due to merging of 'stream' pmqs we *MAY* have duplicate entries */
     if (det_ctx->pmq.rule_id_array_cnt) {
-        int DoSort(const void *a, const void *b) {
-            uint32_t x = *(uint32_t *)a;
-            uint32_t y = *(uint32_t *)b;
-            return x - y;
-        }
         qsort(det_ctx->pmq.rule_id_array, det_ctx->pmq.rule_id_array_cnt,
                 sizeof(uint32_t), DoSort);
     }