diff --git a/src/util-spm-bm.c b/src/util-spm-bm.c index 7706ee14e6..775021a248 100644 --- a/src/util-spm-bm.c +++ b/src/util-spm-bm.c @@ -57,7 +57,7 @@ BmCtx *BoyerMooreCtxInit(uint8_t *needle, uint32_t needle_len) { * \param size length of the string * \param result pointer to an empty array that will hold the badchars */ -inline void PreBmBc(const uint8_t *x, int32_t m, int32_t *bmBc) { +void PreBmBc(const uint8_t *x, int32_t m, int32_t *bmBc) { int32_t i; for (i = 0; i < 256; ++i) { @@ -75,7 +75,7 @@ inline void PreBmBc(const uint8_t *x, int32_t m, int32_t *bmBc) { * \param m length of the string * \param suff pointer to an empty array that will hold the prefixes (shifts) */ -inline void BoyerMooreSuffixes(const uint8_t *x, int32_t m, int32_t *suff) { +void BoyerMooreSuffixes(const uint8_t *x, int32_t m, int32_t *suff) { int32_t f = 0, g, i; suff[m - 1] = m; g = m - 1; @@ -100,7 +100,7 @@ inline void BoyerMooreSuffixes(const uint8_t *x, int32_t m, int32_t *suff) { * \param m length of the string * \param bmGs pointer to an empty array that will hold the prefixes (shifts) */ -inline void PreBmGs(const uint8_t *x, int32_t m, int32_t *bmGs) { +void PreBmGs(const uint8_t *x, int32_t m, int32_t *bmGs) { int32_t i, j; int32_t *suff; @@ -132,7 +132,7 @@ inline void PreBmGs(const uint8_t *x, int32_t m, int32_t *bmGs) { * \param size length of the string * \param result pointer to an empty array that will hold the badchars */ -inline void PreBmBcNocase(const uint8_t *x, int32_t m, int32_t *bmBc) { +void PreBmBcNocase(const uint8_t *x, int32_t m, int32_t *bmBc) { int32_t i; for (i = 0; i < 256; ++i) { @@ -143,7 +143,7 @@ inline void PreBmBcNocase(const uint8_t *x, int32_t m, int32_t *bmBc) { } } -inline void BoyerMooreSuffixesNocase(const uint8_t *x, int32_t m, int32_t *suff) { +void BoyerMooreSuffixesNocase(const uint8_t *x, int32_t m, int32_t *suff) { int32_t f = 0, g, i; suff[m - 1] = m; @@ -172,7 +172,7 @@ inline void BoyerMooreSuffixesNocase(const uint8_t *x, int32_t m, int32_t *suff) * \param m length of the string * \param bmGs pointer to an empty array that will hold the prefixes (shifts) */ -inline void PreBmGsNocase(const uint8_t *x, int32_t m, int32_t *bmGs) { +void PreBmGsNocase(const uint8_t *x, int32_t m, int32_t *bmGs) { int32_t i, j; int32_t* suff; @@ -215,7 +215,7 @@ inline void PreBmGsNocase(const uint8_t *x, int32_t m, int32_t *bmGs) { * * \retval ptr to start of the match; NULL if no match */ -inline uint8_t *BoyerMoore(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc) { +uint8_t *BoyerMoore(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc) { int i, j, m1, m2; #if 0 printf("\nBad:\n"); @@ -259,7 +259,7 @@ inline uint8_t *BoyerMoore(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t * * \retval ptr to start of the match; NULL if no match */ -inline uint8_t *BoyerMooreNocase(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc) { +uint8_t *BoyerMooreNocase(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc) { int i, j, m1, m2; #if 0 printf("\nBad:\n"); diff --git a/src/util-spm-bm.h b/src/util-spm-bm.h index bcae123671..1d3db8f818 100644 --- a/src/util-spm-bm.h +++ b/src/util-spm-bm.h @@ -15,14 +15,14 @@ typedef struct BmCtx_ { /** Prepare and return a Boyer Moore context */ BmCtx *BoyerMooreCtxInit(uint8_t *needle, uint32_t needle_len); -inline void PreBmBc(const uint8_t *x, int32_t m, int32_t *bmBc); -inline void BoyerMooreSuffixes(const uint8_t *x, int32_t m, int32_t *suff); -inline void PreBmGs(const uint8_t *x, int32_t m, int32_t *bmGs); -inline uint8_t *BoyerMoore(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc); -inline void PreBmBcNocase(const uint8_t *x, int32_t m, int32_t *bmBc); -inline void BoyerMooreSuffixesNocase(const uint8_t *x, int32_t m, int32_t *suff); -inline void PreBmGsNocase(const uint8_t *x, int32_t m, int32_t *bmGs); -inline uint8_t *BoyerMooreNocase(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc); +void PreBmBc(const uint8_t *x, int32_t m, int32_t *bmBc); +void BoyerMooreSuffixes(const uint8_t *x, int32_t m, int32_t *suff); +void PreBmGs(const uint8_t *x, int32_t m, int32_t *bmGs); +uint8_t *BoyerMoore(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc); +void PreBmBcNocase(const uint8_t *x, int32_t m, int32_t *bmBc); +void BoyerMooreSuffixesNocase(const uint8_t *x, int32_t m, int32_t *suff); +void PreBmGsNocase(const uint8_t *x, int32_t m, int32_t *bmGs); +uint8_t *BoyerMooreNocase(uint8_t *x, int32_t m, uint8_t *y, int32_t n, int32_t *bmGs, int32_t *bmBc); #endif /* __UTIL_SPM_BM__ */ diff --git a/src/util-spm-bs.c b/src/util-spm-bs.c index 48ea2ec204..c53cd7b0dc 100644 --- a/src/util-spm-bs.c +++ b/src/util-spm-bs.c @@ -28,7 +28,7 @@ * * \retval ptr to start of the match; NULL if no match */ -inline uint8_t *BasicSearch(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len) { +uint8_t *BasicSearch(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len) { SCEnter(); const uint8_t *h, *n; @@ -81,7 +81,7 @@ inline uint8_t *BasicSearch(const uint8_t *haystack, uint32_t haystack_len, cons * * \retval ptr to start of the match; NULL if no match */ -inline uint8_t *BasicSearchNocase(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len) { +uint8_t *BasicSearchNocase(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len) { const uint8_t *h, *n; const uint8_t *hmax = haystack + haystack_len; const uint8_t *nmax = needle + needle_len; @@ -114,7 +114,7 @@ inline uint8_t *BasicSearchNocase(const uint8_t *haystack, uint32_t haystack_len return NULL; } -inline void BasicSearchInit (void) { +void BasicSearchInit (void) { /* nothing no more */ } diff --git a/src/util-spm-bs.h b/src/util-spm-bs.h index 6bb3afbf2c..5e4f74238b 100644 --- a/src/util-spm-bs.h +++ b/src/util-spm-bs.h @@ -4,9 +4,9 @@ #include "suricata-common.h" #include "suricata.h" -inline uint8_t *BasicSearch(const uint8_t *, uint32_t, const uint8_t *, uint32_t); -inline uint8_t *BasicSearchNocase(const uint8_t *, uint32_t, const uint8_t *, uint32_t); -inline void BasicSearchInit (void); +uint8_t *BasicSearch(const uint8_t *, uint32_t, const uint8_t *, uint32_t); +uint8_t *BasicSearchNocase(const uint8_t *, uint32_t, const uint8_t *, uint32_t); +void BasicSearchInit (void); #endif /* __UTIL_SPM_BS__ */ diff --git a/src/util-spm-bs2bm.c b/src/util-spm-bs2bm.c index 552e84336a..542f12f54f 100644 --- a/src/util-spm-bs2bm.c +++ b/src/util-spm-bs2bm.c @@ -25,7 +25,7 @@ * characters that can't be inside the needle_len. So the skips can be * faster */ -inline void Bs2BmBadchars(const uint8_t *needle, uint32_t needle_len, uint8_t *badchars) { +void Bs2BmBadchars(const uint8_t *needle, uint32_t needle_len, uint8_t *badchars) { uint32_t i; for (i = 0; i < ALPHABET_SIZE; i++) badchars[i] = 1; @@ -46,7 +46,7 @@ inline void Bs2BmBadchars(const uint8_t *needle, uint32_t needle_len, uint8_t *b * characters that can't be inside the needle_len. So the skips can be * faster */ -inline void Bs2BmBadcharsNocase(const uint8_t *needle, uint32_t needle_len, uint8_t *badchars) { +void Bs2BmBadcharsNocase(const uint8_t *needle, uint32_t needle_len, uint8_t *badchars) { uint32_t i; for (i = 0; i < ALPHABET_SIZE; i++) badchars[i] = 1; @@ -73,7 +73,7 @@ inline void Bs2BmBadcharsNocase(const uint8_t *needle, uint32_t needle_len, uint * * \retval ptr to start of the match; NULL if no match */ -inline uint8_t * Bs2Bm(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len, uint8_t badchars[]) +uint8_t * Bs2Bm(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len, uint8_t badchars[]) { const uint8_t *h, *n; const uint8_t *hmax = haystack + haystack_len; @@ -122,7 +122,7 @@ inline uint8_t * Bs2Bm(const uint8_t *haystack, uint32_t haystack_len, const uin * * \retval ptr to start of the match; NULL if no match */ -inline uint8_t *Bs2BmNocase(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len, uint8_t badchars[]) +uint8_t *Bs2BmNocase(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *needle, uint32_t needle_len, uint8_t badchars[]) { const uint8_t *h, *n; const uint8_t *hmax = haystack + haystack_len; diff --git a/src/util-spm-bs2bm.h b/src/util-spm-bs2bm.h index 5ec6806198..f90efa79af 100644 --- a/src/util-spm-bs2bm.h +++ b/src/util-spm-bs2bm.h @@ -6,10 +6,10 @@ #define ALPHABET_SIZE 256 -inline void Bs2BmBadchars(const uint8_t *, uint32_t, uint8_t *); -inline void Bs2BmBadcharsNocase(const uint8_t *, uint32_t, uint8_t *); -inline uint8_t * Bs2Bm(const uint8_t *, uint32_t, const uint8_t *, uint32_t, uint8_t []); -inline uint8_t *Bs2BmNocase(const uint8_t *, uint32_t, const uint8_t *, uint32_t, uint8_t []); +void Bs2BmBadchars(const uint8_t *, uint32_t, uint8_t *); +void Bs2BmBadcharsNocase(const uint8_t *, uint32_t, uint8_t *); +uint8_t * Bs2Bm(const uint8_t *, uint32_t, const uint8_t *, uint32_t, uint8_t []); +uint8_t *Bs2BmNocase(const uint8_t *, uint32_t, const uint8_t *, uint32_t, uint8_t []); #endif /* __UTIL_SPM_BS2BM__ */ diff --git a/src/util-spm.c b/src/util-spm.c index 49a8111cfc..2486299657 100644 --- a/src/util-spm.c +++ b/src/util-spm.c @@ -55,7 +55,7 @@ * \param needle pattern to search for * \param needlelen length of the pattern */ -inline uint8_t *Bs2bmSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { +uint8_t *Bs2bmSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { uint8_t badchars[ALPHABET_SIZE]; Bs2BmBadchars(needle, needlelen, badchars); @@ -70,7 +70,7 @@ inline uint8_t *Bs2bmSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, ui * \param needle pattern to search for * \param needlelen length of the pattern */ -inline uint8_t *Bs2bmNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { +uint8_t *Bs2bmNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { uint8_t badchars[ALPHABET_SIZE]; Bs2BmBadchars(needle, needlelen, badchars); @@ -86,7 +86,7 @@ inline uint8_t *Bs2bmNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *need * \param needle pattern to search for * \param needlelen length of the pattern */ -inline uint8_t *BoyerMooreSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { +uint8_t *BoyerMooreSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { int32_t bmBc[ALPHABET_SIZE]; int32_t *bmGs = SCMalloc(sizeof(int32_t)*(needlelen + 1)); @@ -108,7 +108,7 @@ inline uint8_t *BoyerMooreSearch(uint8_t *text, uint32_t textlen, uint8_t *needl * \param needle pattern to search for * \param needlelen length of the pattern */ -inline uint8_t *BoyerMooreNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { +uint8_t *BoyerMooreNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen) { int32_t bmBc[ALPHABET_SIZE]; int32_t *bmGs = SCMalloc(sizeof(int32_t)*(needlelen + 1)); @@ -138,7 +138,7 @@ inline uint8_t *BoyerMooreNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t * \param times If you are testing performance, se the numebr of times * that you want to repeat the search */ -inline uint8_t *BasicSearchWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BasicSearchWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -157,7 +157,7 @@ inline uint8_t *BasicSearchWrapper(uint8_t *text, uint8_t *needle, int times) { return ret; } -inline uint8_t *BasicSearchNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BasicSearchNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -173,7 +173,7 @@ inline uint8_t *BasicSearchNocaseWrapper(uint8_t *text, uint8_t *needle, int tim return ret; } -inline uint8_t *Bs2bmWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *Bs2bmWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -192,7 +192,7 @@ inline uint8_t *Bs2bmWrapper(uint8_t *text, uint8_t *needle, int times) { return ret; } -inline uint8_t *Bs2bmNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *Bs2bmNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -211,7 +211,7 @@ inline uint8_t *Bs2bmNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { return ret; } -inline uint8_t *BoyerMooreWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BoyerMooreWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -234,7 +234,7 @@ inline uint8_t *BoyerMooreWrapper(uint8_t *text, uint8_t *needle, int times) { return ret; } -inline uint8_t *BoyerMooreNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BoyerMooreNocaseWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -265,7 +265,7 @@ inline uint8_t *BoyerMooreNocaseWrapper(uint8_t *text, uint8_t *needle, int time * \param times If you are testing performance, se the numebr of times * that you want to repeat the search */ -inline uint8_t *BasicSearchCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BasicSearchCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -282,7 +282,7 @@ inline uint8_t *BasicSearchCtxWrapper(uint8_t *text, uint8_t *needle, int times) return ret; } -inline uint8_t *BasicSearchNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BasicSearchNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -299,7 +299,7 @@ inline uint8_t *BasicSearchNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int return ret; } -inline uint8_t *Bs2bmCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *Bs2bmCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -319,7 +319,7 @@ inline uint8_t *Bs2bmCtxWrapper(uint8_t *text, uint8_t *needle, int times) { return ret; } -inline uint8_t *Bs2bmNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *Bs2bmNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -339,7 +339,7 @@ inline uint8_t *Bs2bmNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) return ret; } -inline uint8_t *BoyerMooreCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BoyerMooreCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -363,7 +363,7 @@ inline uint8_t *BoyerMooreCtxWrapper(uint8_t *text, uint8_t *needle, int times) return ret; } -inline uint8_t *RawCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *RawCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); @@ -379,7 +379,7 @@ inline uint8_t *RawCtxWrapper(uint8_t *text, uint8_t *needle, int times) { return ret; } -inline uint8_t *BoyerMooreNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) { +uint8_t *BoyerMooreNocaseCtxWrapper(uint8_t *text, uint8_t *needle, int times) { uint32_t textlen = strlen((char *)text); uint32_t needlelen = strlen((char *)needle); diff --git a/src/util-spm.h b/src/util-spm.h index bbc0cf861b..6818a990a0 100644 --- a/src/util-spm.h +++ b/src/util-spm.h @@ -8,10 +8,10 @@ #include "util-spm-bm.h" /** Default algorithm to use: Boyer Moore */ -inline uint8_t *Bs2bmSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); -inline uint8_t *Bs2bmNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); -inline uint8_t *BoyerMooreSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); -inline uint8_t *BoyerMooreNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); +uint8_t *Bs2bmSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); +uint8_t *Bs2bmNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); +uint8_t *BoyerMooreSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); +uint8_t *BoyerMooreNocaseSearch(uint8_t *text, uint32_t textlen, uint8_t *needle, uint32_t needlelen); /* Macros for automatic algorithm selection (use them only when you can't store the context) */ #define SpmSearch(text, textlen, needle, needlelen) ({\