]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mpm/spm: spelling
authorVictor Julien <vjulien@oisf.net>
Fri, 5 May 2023 18:39:56 +0000 (20:39 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 6 May 2023 12:50:43 +0000 (14:50 +0200)
src/util-mpm-ac-bs.c
src/util-mpm-ac-ks.c
src/util-mpm-ac.c
src/util-mpm.h
src/util-spm-bm.c
src/util-spm-bm.h
src/util-spm-bs.c
src/util-spm-bs2bm.c

index 4801cba2cc07d8d4765121441b55c7d81e70e143..0bc5efd4bcd4056a0ebaa8798380b11516a68f60 100644 (file)
  *           If you can fit the ruleset with this mpm on your box without hitting
  *           swap, this is the MPM to go for.
  *
- * \todo - Do a proper analyis of our existing MPMs and suggest a good one based
+ * \todo - Do a proper analysis of our existing MPMs and suggest a good one based
  *         on the pattern distribution and the expected traffic(say http).
  *       - Tried out loop unrolling without any perf increase.  Need to dig deeper.
  *       - Irrespective of whether we cross 2 ** 16 states or not,shift to using
  *         uint32_t for state type, so that we can integrate it's status as a
  *         final state or not in the topmost byte.  We are already doing it if
  *         state_count is > 2 ** 16.
- *       - Test case-senstive patterns if they have any ascii chars.  If they
+ *       - Test case-sensitive patterns if they have any ascii chars.  If they
  *         don't treat them as nocase.
  *       - Carry out other optimizations we are working on.  hashes, compression.
  */
@@ -721,7 +721,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
                 k++;
             }
             /* if we have any non 0 transitions from our previous for search,
-             * store the acii codes as well the corresponding states */
+             * store the ascii codes as well the corresponding states */
             if (k > 0) {
                 no_of_entries[0] = k;
                 if (state != 0)
@@ -793,7 +793,7 @@ static inline void SCACBSCreateModDeltaTable(MpmCtx *mpm_ctx)
                 k++;
             }
             /* if we have any non 0 transitions from our previous for search,
-             * store the acii codes as well the corresponding states */
+             * store the ascii codes as well the corresponding states */
             if (k > 0) {
                 no_of_entries[0] = k;
                 if (state != 0)
index 983345b9884dff8810c66a0a624f634c4739b741..9b2ab07d3262b0a576826354867b3e3ad053a8dd 100644 (file)
@@ -50,7 +50,7 @@
  *               the alphabet, so that it is constant inside the
  *               function for better optimization.
  *
- * \todo - Do a proper analyis of our existing MPMs and suggest a good
+ * \todo - Do a proper analysis of our existing MPMs and suggest a good
  *         one based on the pattern distribution and the expected
  *         traffic(say http).
 
@@ -59,7 +59,7 @@
  *         integrate it's status as a final state or not in the
  *         topmost byte.  We are already doing it if state_count is >
  *         2 ** 16.
- *       - Test case-senstive patterns if they have any ascii chars.
+ *       - Test case-sensitive patterns if they have any ascii chars.
  *         If they don't treat them as nocase.
  *       - Reorder the compressed alphabet to put the most common characters
  *         first.
@@ -169,10 +169,9 @@ static void SCACTileGetConfig(void)
 {
 }
 
-
 /**
  * \internal
- * \brief Count the occurences of each character in the pattern and
+ * \brief Count the occurrences of each character in the pattern and
  * accumulate into a histogram. Really only used to detect unused
  * characters, so could just set to 1 instead of counting.
  */
@@ -184,7 +183,7 @@ static inline void SCACTileHistogramAlphabet(SCACTileCtx *ctx,
     }
 }
 
-/* Use Alpahbet Histogram to create compressed alphabet.
+/* Use Alphabet Histogram to create compressed alphabet.
  */
 static void SCACTileInitTranslateTable(SCACTileCtx *ctx)
 {
@@ -212,7 +211,7 @@ static void SCACTileInitTranslateTable(SCACTileCtx *ctx)
     SCLogDebug("  Alphabet size %d", ctx->alphabet_size);
 
     /* Round alphabet size up to next power-of-two Leave one extra
-     * space For the unused-chararacters = 0 mapping.
+     * space For the unused-characters = 0 mapping.
      */
     ctx->alphabet_size += 1; /* Extra space for unused-character */
     if (ctx->alphabet_size  <= 8) {
@@ -1175,7 +1174,7 @@ static int CheckMatch(const SCACTileSearchCtx *ctx, PrefilterRuleStore *pmq,
         if (mpm_bitarray[pindex / 8] & (1 << (pindex % 8))) {
             /* Pattern already seen by this MPM. */
             /* NOTE: This is faster then rechecking if it is a case-sensitive match
-             * since we know this pattern has already been seen, but imcrementing
+             * since we know this pattern has already been seen, but incrementing
              * matches here could over report matches. For example if the case-sensitive
              * pattern is "Foo" and the string is "Foo bar foo", matches would be reported
              * as 2, when it should really be 1, since "foo" is not a true match.
@@ -1188,7 +1187,7 @@ static int CheckMatch(const SCACTileSearchCtx *ctx, PrefilterRuleStore *pmq,
         if (offset < (int)pat->offset || (pat->depth && i > pat->depth))
             continue;
 
-        /* Double check case-sensitve match now. */
+        /* Double check case-sensitive match now. */
         if (patterns[k] >> 31) {
             const uint16_t patlen = pat->patlen;
             if (SCMemcmp(pat->cs, buf_offset - patlen, patlen) != 0) {
index c70920746472569bcde0e5939010509486d36d17..614b51422b6131b81a3859dc3479b2177133ada4 100644 (file)
  *           If you can fit the ruleset with this mpm on your box without hitting
  *           swap, this is the MPM to go for.
  *
- * \todo - Do a proper analyis of our existing MPMs and suggest a good one based
+ * \todo - Do a proper analysis of our existing MPMs and suggest a good one based
  *         on the pattern distribution and the expected traffic(say http).
  *       - Tried out loop unrolling without any perf increase.  Need to dig deeper.
  *       - Irrespective of whether we cross 2 ** 16 states or not,shift to using
  *         uint32_t for state type, so that we can integrate it's status as a
  *         final state or not in the topmost byte.  We are already doing it if
  *         state_count is > 2 ** 16.
- *       - Test case-senstive patterns if they have any ascii chars.  If they
+ *       - Test case-sensitive patterns if they have any ascii chars.  If they
  *         don't treat them as nocase.
  *       - Carry out other optimizations we are working on.  hashes, compression.
  */
index bf3772f9517243f22ff3cfdd0870de1a077b88fd..422a2779d34f19bb65d6baeef2ec2d181b71ab7c 100644 (file)
@@ -55,7 +55,7 @@ typedef struct MpmThreadCtx_ {
 typedef struct MpmPattern_ {
     /* length of the pattern */
     uint16_t len;
-    /* flags decribing the pattern */
+    /* flags describing the pattern */
     uint8_t flags;
 
     /* offset into the buffer where match may start */
index 9983eec73ab731db4c89e13c9a8253984204220b..29dbf4a3ecd61cc2662f72b77f3bbc5bf51ca51c 100644 (file)
@@ -24,8 +24,8 @@
  *
  * Boyer Moore algorithm has a really good performance. It need two arrays
  * of context for each pattern that hold applicable shifts on the text
- * to seach in, based on characters not available in the pattern
- * and combinations of characters that start a sufix of the pattern.
+ * to search in, based on characters not available in the pattern
+ * and combinations of characters that start a suffix of the pattern.
  * If possible, we should store the context of patterns that we are going
  * to search for multiple times, so we don't spend time on rebuilding them.
  */
@@ -68,7 +68,7 @@ void BoyerMooreCtxToNocase(BmCtx *bm_ctx, uint8_t *needle, uint16_t needle_len)
 }
 
 /**
- * \brief Setup a Booyer Moore context.
+ * \brief Setup a Boyer Moore context.
  *
  * \param str pointer to the pattern string
  * \param size length of the string
@@ -87,7 +87,7 @@ BmCtx *BoyerMooreCtxInit(const uint8_t *needle, uint16_t needle_len)
 
     /* Prepare good Suffixes */
     if (PreBmGs(needle, needle_len, new->bmGs) == -1) {
-        FatalError("Fatal error encountered in BooyerMooreCtxInit. Exiting...");
+        FatalError("Fatal error encountered in BoyerMoreCtxInit. Exiting...");
     }
 
 
@@ -95,7 +95,7 @@ BmCtx *BoyerMooreCtxInit(const uint8_t *needle, uint16_t needle_len)
 }
 
 /**
- * \brief Setup a Booyer Moore context for nocase search
+ * \brief Setup a Boyer Moore context for nocase search
  *
  * \param str pointer to the pattern string
  * \param size length of the string
@@ -112,7 +112,7 @@ BmCtx *BoyerMooreNocaseCtxInit(uint8_t *needle, uint16_t needle_len)
 }
 
 /**
- * \brief Free the memory allocated to Booyer Moore context.
+ * \brief Free the memory allocated to Boyer Moore context.
  *
  * \param bmCtx pointer to the Context for the pattern
  */
index de7cc492e6d94b44259a40513da1d171ec6c2411..3c5e59ce03fb82dd3a87bb7afe9c77a873bcef96 100644 (file)
@@ -29,7 +29,7 @@
 
 #define ALPHABET_SIZE 256
 
-/* Context for booyer moore */
+/* Context for boyer moore */
 typedef struct BmCtx_ {
     uint16_t bmBc[ALPHABET_SIZE];
     //C99 "flexible array member"
index 6d49ff658347a471d2549ad7125224cfd12bb9ca..823e2a646b68acb6e1a0407fac32db64d585f8a5 100644 (file)
 #include "util-debug.h"
 #include "util-spm-bs.h"
 
-
 /**
  * \brief Basic search improved. Limits are better handled, so
  * it doesn't start searches that wont fit in the remaining buffer
  *
  * \param haystack pointer to the buffer to search in
  * \param haystack_len length limit of the buffer
- * \param neddle pointer to the pattern we ar searching for
+ * \param needle pointer to the pattern we ar searching for
  * \param needle_len length limit of the needle
  *
  * \retval ptr to start of the match; NULL if no match
@@ -94,7 +93,7 @@ uint8_t *BasicSearch(const uint8_t *haystack, uint32_t haystack_len, const uint8
  *
  * \param haystack pointer to the buffer to search in
  * \param haystack_len length limit of the buffer
- * \param neddle pointer to the pattern we ar searching for
+ * \param needle pointer to the pattern we ar searching for
  * \param needle_len length limit of the needle
  *
  * \retval ptr to start of the match; NULL if no match
index 85d85dced616b63d1afa1a718a80749ff8b04b75..589e6e9d92db1d7d228e81c4556bd8787a15f88a 100644 (file)
@@ -20,7 +20,7 @@
  *
  * \author Pablo Rincon Crespo <pablo.rincon.crespo@gmail.com>
  *
- * Bs2Bm use a simple context array to determine the charactes
+ * Bs2Bm use a simple context array to determine the characters
  * that are not present on the pattern. This way on partial matches
  * broken by a char not present, we can skip to the next character
  * making less checks
@@ -34,7 +34,7 @@
 /**
  * \brief Array setup function for Bs2Bm of bad characters index (not found at the needle)
  *
- * \param neddle pointer to the pattern we ar searching for
+ * \param needle pointer to the pattern we ar searching for
  * \param needle_len length limit of the needle
  * \param badchars pointer to an empty array of bachars. The array prepared contains
  *                 characters that can't be inside the needle_len. So the skips can be
@@ -56,7 +56,7 @@ void Bs2BmBadchars(const uint8_t *needle, uint16_t needle_len, uint8_t *badchars
 /**
  * \brief Array setup function for Bs2BmNocase of bad characters index (not found at the needle)
  *
- * \param neddle pointer to the pattern we ar searching for
+ * \param needle pointer to the pattern we ar searching for
  * \param needle_len length limit of the needle
  * \param badchars pointer to an empty array of bachars. The array prepared contains
  *                 characters that can't be inside the needle_len. So the skips can be
@@ -76,7 +76,6 @@ void Bs2BmBadcharsNocase(const uint8_t *needle, uint16_t needle_len, uint8_t *ba
     }
 }
 
-
 /**
  * \brief Basic search with a bad characters array. The array badchars contains
  *        flags at character's ascii index that can't be inside the needle. So the skips can be
@@ -84,7 +83,7 @@ void Bs2BmBadcharsNocase(const uint8_t *needle, uint16_t needle_len, uint8_t *ba
  *
  * \param haystack pointer to the buffer to search in
  * \param haystack_len length limit of the buffer
- * \param neddle pointer to the pattern we ar searching for
+ * \param needle pointer to the pattern we ar searching for
  * \param needle_len length limit of the needle
  * \param badchars pointer to an array of bachars prepared by Bs2BmBadchars()
  *
@@ -134,7 +133,7 @@ uint8_t *Bs2Bm(const uint8_t *haystack, uint32_t haystack_len, const uint8_t *ne
  *
  * \param haystack pointer to the buffer to search in
  * \param haystack_len length limit of the buffer
- * \param neddle pointer to the pattern we ar searching for
+ * \param needle pointer to the pattern we ar searching for
  * \param needle_len length limit of the needle
  * \param badchars pointer to an array of bachars prepared by Bs2BmBadchars()
  *