memcpy: rename memcpy_tolower

Rename to match coding style. Update callers.

Minor loop cleanup.
pull/14511/head
Victor Julien 2 years ago
parent c4360cd515
commit a16c6ff6a5

@ -37,13 +37,10 @@
* \param s Pointer to the src string for memcpy.
* \param len len of the string sent in s.
*/
static inline void memcpy_tolower(uint8_t *d, const uint8_t *s, uint16_t len)
static inline void MemcpyToLower(uint8_t *d, const uint8_t *s, size_t n)
{
uint16_t i;
for (i = 0; i < len; i++)
for (size_t i = 0; i < n; i++)
d[i] = u8_tolower(s[i]);
return;
}
#endif /* SURICATA_UTIL_MEMCPY_H */

@ -476,7 +476,7 @@ int MpmAddPattern(MpmCtx *mpm_ctx, const uint8_t *pat, uint16_t patlen, uint16_t
goto error;
mpm_ctx->memory_cnt++;
mpm_ctx->memory_size += patlen;
memcpy_tolower(p->ci, pat, patlen);
MemcpyToLower(p->ci, pat, patlen);
/* setup the case sensitive part of the pattern */
if (p->flags & MPM_PATTERN_FLAG_NOCASE) {

@ -58,7 +58,7 @@ static void PreBmGsNocase(const uint8_t *x, uint16_t m, uint16_t *bmGs);
void BoyerMooreCtxToNocase(BmCtx *bm_ctx, uint8_t *needle, uint16_t needle_len)
{
/* Store the content as lower case to make searching faster */
memcpy_tolower(needle, needle, needle_len);
MemcpyToLower(needle, needle, needle_len);
/* Prepare bad chars with nocase chars */
PreBmBcNocase(needle, needle_len, bm_ctx->bmBc);

Loading…
Cancel
Save