summaryrefslogtreecommitdiff
path: root/src/string.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2026-05-09 17:56:53 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2026-05-09 17:56:53 +0200
commit1f8a958cf61bc473bb0aa05a133ad40412910811 (patch)
treeb934c7ab6847599032c82b1c6d8bc2697cae44a6 /src/string.c
parent2dd4663ee68419059f327545e70095c4257b19e3 (diff)
New upstream version 5.4upstream
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/string.c b/src/string.c
index e9c162d..445b466 100644
--- a/src/string.c
+++ b/src/string.c
@@ -7,6 +7,9 @@
* General Public License as published by the Free Software Foundation;
* either version 2.1 or (at your option) any later version.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <errno.h>
#include <limits.h>
#include <math.h> /* nextafter */
@@ -16,6 +19,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
#include <libHX/ctype_helper.h>
#include <libHX/string.h>
#include "internal.h"
@@ -176,7 +182,6 @@ EXPORT_SYMBOL void *HX_memmem(const void *vspace, size_t spacesize,
const char *space = vspace, *point = vpoint;
const char *head, *end;
size_t tailsize;
- char *tail;
if (pointsize == 0)
return const_cast1(void *, vspace);
@@ -185,9 +190,9 @@ EXPORT_SYMBOL void *HX_memmem(const void *vspace, size_t spacesize,
/* Do a BM-style trailer search and reduce calls to memcmp */
head = space + (pointsize - 1);
- tail = memchr(head, point[pointsize-1], spacesize - (pointsize - 1));
+ const char *tail = memchr(head, point[pointsize-1], spacesize - (pointsize - 1));
if (tail == NULL || pointsize == 1)
- return tail;
+ return const_cast1(char *, tail);
end = space + spacesize;
do {
head = tail - pointsize + 1;