summaryrefslogtreecommitdiff
path: root/src/libstddjb/case_str.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-22 15:28:36 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-22 15:28:36 +0000
commit753ceac3272a8c4f150ace8b4695991a85345c3c (patch)
treef9e62f7d544f634bc6e8b13b194f10182c980d91 /src/libstddjb/case_str.c
parentaebe8604605b41803c43c1def87549569b821b27 (diff)
downloadskalibs-753ceac3272a8c4f150ace8b4695991a85345c3c.tar.xz
Revamp case functions, add strcasestr() fallback
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/case_str.c')
-rw-r--r--src/libstddjb/case_str.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/libstddjb/case_str.c b/src/libstddjb/case_str.c
deleted file mode 100644
index 59f157f..0000000
--- a/src/libstddjb/case_str.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/sysdeps.h>
-
-#ifdef SKALIBS_HASSTRCASESTR
-
-#include <skalibs/nonposix.h>
-#include <string.h>
-#include <skalibs/bytestr.h>
-
-size_t case_str (char const *haystack, char const *needle)
-{
- char *p = strcasestr(haystack, needle) ;
- return p ? p - haystack : strlen(haystack) ;
-}
-
-#else
-
-#include <string.h>
-#include <strings.h>
-#include <skalibs/bytestr.h>
-
-size_t case_str (char const *haystack, char const *needle)
-{
- size_t nlen = strlen(needle) ;
- char const *p = haystack ;
- if (!nlen) return 0 ;
- for (; *p ; p++)
- if (!strncasecmp(p, needle, nlen)) return p - haystack ;
- return strlen(haystack) ;
-}
-
-#endif