Skip to content

Commit e1f83c2

Browse files
committed
util: remove memrchr
And replace its only usage by strrchr as we are using a null-terminated string in this case
1 parent 376db8f commit e1f83c2

6 files changed

Lines changed: 2 additions & 107 deletions

File tree

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
AC_FUNC_MMAP
208208
AC_FUNC_STRTOD
209209

210-
AC_CHECK_FUNCS([memmem memset memchr memrchr memmove])
210+
AC_CHECK_FUNCS([memmem memset memchr memmove])
211211
AC_CHECK_FUNCS([strcasecmp strchr strrchr strdup strndup strncasecmp strtol strstr strpbrk strtoull strtoumax])
212212
AC_CHECK_FUNCS([strerror])
213213
AC_CHECK_FUNCS([gethostname inet_ntoa uname])

src/Makefile.am

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ noinst_HEADERS = \
541541
util-mem.h \
542542
util-memcmp.h \
543543
util-memcpy.h \
544-
util-memrchr.h \
545544
util-misc.h \
546545
util-mpm-ac-ks.h \
547546
util-mpm-ac-queue.h \
@@ -1100,7 +1099,6 @@ libsuricata_c_a_SOURCES = \
11001099
util-magic.c \
11011100
util-mem.c \
11021101
util-memcmp.c \
1103-
util-memrchr.c \
11041102
util-misc.c \
11051103
util-mpm-ac-ks-small.c \
11061104
util-mpm-ac-ks.c \

src/app-layer-htp-xff.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
#include "app-layer-htp.h"
3030
#include "app-layer-htp-xff.h"
3131

32-
#ifndef HAVE_MEMRCHR
33-
#include "util-memrchr.h"
34-
#endif
35-
3632
#include "util-misc.h"
3733
#include "util-unittest.h"
3834

@@ -123,7 +119,7 @@ static int HttpXFFGetIPFromTxAux(
123119

124120
if (xff_cfg->flags & XFF_REVERSE) {
125121
/** Get the last IP address from the chain */
126-
p_xff = memrchr(xff_chain, ' ', htp_header_value_len(h_xff));
122+
p_xff = strrchr(xff_chain, ' ');
127123
if (p_xff == NULL) {
128124
p_xff = xff_chain;
129125
} else {

src/runmode-unittests.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
#include "util-proto-name.h"
9292
#include "util-macset.h"
9393
#include "util-flow-rate.h"
94-
#include "util-memrchr.h"
9594

9695
#include "util-mpm-ac.h"
9796
#include "util-mpm-hs.h"

src/util-memrchr.c

Lines changed: 0 additions & 68 deletions
This file was deleted.

src/util-memrchr.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)