]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix/suppress a couple of harmless compiler warnings.
authorVictor Julien <victor@inliniac.net>
Tue, 9 Oct 2012 15:22:42 +0000 (17:22 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 10 Oct 2012 13:00:00 +0000 (15:00 +0200)
src/alert-debuglog.c
src/detect-filemd5.c
src/log-httplog.c
src/util-buffer.h
src/util-host-os-info.c

index af2eb2da620baf177edaf1a40e7786c054a6a2c0..b4708f086908205cc8a1bc8549b7e97b71da000c 100644 (file)
@@ -342,7 +342,7 @@ TmEcode AlertDebugLogger(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq,
     }
 
     SCMutexLock(&aft->file_ctx->fp_mutex);
-    MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
+    (void)MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
     fflush(aft->file_ctx->fp);
     aft->file_ctx->alerts += p->alerts.cnt;
     SCMutexUnlock(&aft->file_ctx->fp_mutex);
@@ -402,7 +402,7 @@ TmEcode AlertDebugLogDecoderEvent(ThreadVars *tv, Packet *p, void *data, PacketQ
                          GET_PKT_DATA(p), GET_PKT_LEN(p));
 
     SCMutexLock(&aft->file_ctx->fp_mutex);
-    MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
+    (void)MemBufferPrintToFPAsString(aft->buffer, aft->file_ctx->fp);
     fflush(aft->file_ctx->fp);
     aft->file_ctx->alerts += p->alerts.cnt;
     SCMutexUnlock(&aft->file_ctx->fp_mutex);
index 27c9ee3d1f2df828a8f4607ab4136c16d67632bd..6bb9d0325751d9e19f7a7fecac19fd1f33367185 100644 (file)
@@ -142,18 +142,6 @@ static int MD5MatchLookupBuffer(ROHashTable *hash, uint8_t *buf, size_t buflen)
         return 1;
 }
 
-static int MD5MatchLookupString(ROHashTable *hash, char *string) {
-    uint8_t md5[16];
-    if (Md5ReadString(md5, string) == 1) {
-        void *ptr = ROHashLookup(hash, &md5, (uint16_t)sizeof(md5));
-        if (ptr == NULL)
-            return 0;
-        else
-            return 1;
-    }
-    return 0;
-}
-
 /**
  * \brief match the specified filemd5
  *
@@ -352,6 +340,18 @@ static void DetectFileMd5Free(void *ptr) {
 }
 
 #ifdef UNITTESTS
+static int MD5MatchLookupString(ROHashTable *hash, char *string) {
+    uint8_t md5[16];
+    if (Md5ReadString(md5, string) == 1) {
+        void *ptr = ROHashLookup(hash, &md5, (uint16_t)sizeof(md5));
+        if (ptr == NULL)
+            return 0;
+        else
+            return 1;
+    }
+    return 0;
+}
+
 static int MD5MatchTest01(void) {
     ROHashTable *hash = ROHashInit(4, 16);
     if (hash == NULL) {
index 15ff9e2cafb218d737d43b837d8a006fb6471be2..4a83f57b3a62ea11fe412390cbb15ff2e7f5f0fe 100644 (file)
@@ -523,7 +523,7 @@ static TmEcode LogHttpLogIPWrapper(ThreadVars *tv, Packet *p, void *data, Packet
         aft->uri_cnt ++;
 
         SCMutexLock(&hlog->file_ctx->fp_mutex);
-        MemBufferPrintToFPAsString(aft->buffer, hlog->file_ctx->fp);
+        (void)MemBufferPrintToFPAsString(aft->buffer, hlog->file_ctx->fp);
         fflush(hlog->file_ctx->fp);
         SCMutexUnlock(&hlog->file_ctx->fp_mutex);
 
index 9c4813688c08b61483a902e3d0382ebfbdb1aa81..0ab4583a3233351822fcf83e00b1379ed0659e3d 100644 (file)
@@ -74,9 +74,9 @@ void MemBufferFree(MemBuffer *buffer);
  * \param buffer Pointer to the src MemBuffer instance to write.
  * \param fp     Pointer to the file file instance to write to.
  */
-#define MemBufferPrintToFPAsString(mem_buffer, fp) do {                     \
-        fwrite((mem_buffer)->buffer, sizeof(uint8_t), (mem_buffer)->offset, fp); \
-    } while (0)
+#define MemBufferPrintToFPAsString(mem_buffer, fp) ({                           \
+    fwrite((mem_buffer)->buffer, sizeof(uint8_t), (mem_buffer)->offset, fp);    \
+})
 
 /**
  * \brief Write a buffer in hex format.
index d692f5df03970449d7184f0c48b0944eaa7255f7..fb343140487dc966edb0896146a8ddfb81db0922 100644 (file)
@@ -60,22 +60,6 @@ SCEnumCharMap sc_hinfo_os_policy_map[ ] = {
 static SCRadixTree *sc_hinfo_tree = NULL;
 static SCRadixTree *sc_hinfo_tree_backup = NULL;
 
-static void SCHInfoCreateContextBackup(void)
-{
-    sc_hinfo_tree_backup = sc_hinfo_tree;
-    sc_hinfo_tree = NULL;
-
-    return;
-}
-
-static void SCHInfoRestoreContextBackup(void)
-{
-    sc_hinfo_tree = sc_hinfo_tree_backup;
-    sc_hinfo_tree_backup = NULL;
-
-    return;
-}
-
 /**
  * \brief Validates an IPV4 address and returns the network endian arranged
  *        version of the IPV4 address
@@ -448,6 +432,22 @@ void SCHInfoLoadFromConfig(void)
 
 #ifdef UNITTESTS
 
+static void SCHInfoCreateContextBackup(void)
+{
+    sc_hinfo_tree_backup = sc_hinfo_tree;
+    sc_hinfo_tree = NULL;
+
+    return;
+}
+
+static void SCHInfoRestoreContextBackup(void)
+{
+    sc_hinfo_tree = sc_hinfo_tree_backup;
+    sc_hinfo_tree_backup = NULL;
+
+    return;
+}
+
 /**
  * \test Check if we the IPs with the right OS flavours are added to the host OS
  *       radix tree, and the IPS with invalid flavours returns an error(-1)