Browse code

fixed build compilation when compiled without pcre support

Kevin Lin authored on 2014/09/19 03:10:12
Showing 2 changed files
... ...
@@ -26,7 +26,6 @@
26 26
 #include "clamav-config.h"
27 27
 #endif
28 28
 
29
-#if HAVE_PCRE
30 29
 #include "clamav.h"
31 30
 #include "cltypes.h"
32 31
 #include "dconf.h"
... ...
@@ -37,6 +36,7 @@
37 37
 #include "mpool.h"
38 38
 #include "regex_pcre.h"
39 39
 
40
+#if HAVE_PCRE
40 41
 /* DEBUGGING */
41 42
 //#define MATCHER_PCRE_DEBUG
42 43
 #ifdef MATCHER_PCRE_DEBUG
... ...
@@ -724,4 +724,24 @@ void cli_pcre_freetable(struct cli_matcher *root)
724 724
     root->pcre_metas = 0;
725 725
 }
726 726
 
727
+#else
728
+/* NO-PCRE FUNCTIONS */
729
+int cli_pcre_recaloff(struct cli_matcher *root, struct cli_pcre_off *data, struct cli_target_info *info, cli_ctx *ctx)
730
+{
731
+    UNUSEDPARAM(root);
732
+    UNUSEDPARAM(info);
733
+    UNUSEDPARAM(ctx);
734
+    if (data) {
735
+        data->offset = NULL;
736
+        data->shift = NULL;
737
+    }
738
+    return CL_SUCCESS;
739
+}
740
+
741
+void cli_pcre_freeoff(struct cli_pcre_off *data)
742
+{
743
+    UNUSEDPARAM(data);
744
+    return;
745
+}
746
+
727 747
 #endif /* HAVE_PCRE */
... ...
@@ -25,7 +25,6 @@
25 25
 #ifndef __MATCHER_PCRE_H
26 26
 #define __MATCHER_PCRE_H
27 27
 
28
-#if HAVE_PCRE
29 28
 #if HAVE_CONFIG_H
30 29
 #include "clamav-config.h"
31 30
 #endif
... ...
@@ -37,6 +36,12 @@
37 37
 #include "mpool.h"
38 38
 #include "regex_pcre.h"
39 39
 
40
+/* stores offset data */
41
+struct cli_pcre_off {
42
+    uint32_t *offset, *shift;
43
+};
44
+
45
+#if HAVE_PCRE
40 46
 #define PCRE_BYPASS "7374756c747a676574737265676578"
41 47
 #define CLI_PCRE_GLOBAL    0x00000001 /* g */
42 48
 #define CLI_PCRE_ENCOMPASS 0x00000002 /* e */
... ...
@@ -56,11 +61,6 @@ struct cli_pcre_meta {
56 56
     uint32_t sigtime_id, sigmatch_id;
57 57
 };
58 58
 
59
-/* stores offset data */
60
-struct cli_pcre_off {
61
-    uint32_t *offset, *shift;
62
-};
63
-
64 59
 /* PCRE PERFORMANCE DECLARATIONS */
65 60
 void cli_pcre_perf_print();
66 61
 void cli_pcre_perf_events_destroy();
... ...
@@ -73,5 +73,9 @@ void cli_pcre_freeoff(struct cli_pcre_off *data);
73 73
 int cli_pcre_scanbuf(const unsigned char *buffer, uint32_t length, const struct cli_matcher *root, struct cli_ac_data *mdata,  struct cli_ac_result **res, const struct cli_pcre_off *data, cli_ctx *ctx);
74 74
 void cli_pcre_freemeta(struct cli_pcre_meta *pm);
75 75
 void cli_pcre_freetable(struct cli_matcher *root);
76
+#else
77
+/* NO-PCRE DECLARATIONS - defined because encasing everything in '#if' is a pain */
78
+inline int cli_pcre_recaloff(struct cli_matcher *root, struct cli_pcre_off *data, struct cli_target_info *info, cli_ctx *ctx);
79
+inline void cli_pcre_freeoff(struct cli_pcre_off *data);
76 80
 #endif /* HAVE_PCRE */
77 81
 #endif /*__MATCHER_PCRE_H*/