check for _GNU_SOURCE for nongnu_strcasestr

idk we dont need it and it throws warnings on new glibc so i dont want it tbh
This commit is contained in:
alufolie91 committed 2026-02-23 17:51:06 +01:00
1 parent 1b5b85d083
commit 2312445276
2 files changed
+11 -8

No files matched your search

+1 -1
View File
@@ -68,8 +68,8 @@ extern "C" {
#define strnicmp(x,y,n) strncasecmp(x,y,n)
#endif
char *nongnu_strcasestr(const char *in, const char *what);
#ifndef _GNU_SOURCE
char *nongnu_strcasestr(const char *in, const char *what);
#define strcasestr nongnu_strcasestr
#endif
+10 -7
View File
@@ -23,24 +23,26 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _GNU_SOURCE
#include <string.h>
#include <ctype.h>
#include <stddef.h>
static inline int
trycmp (char **pp, char *cp,
const char *q, size_t qn)
static inline int trycmp(char **pp, char *cp, const char *q, size_t qn)
{
char *p;
p = (*pp);
if (strncasecmp(p, q, qn) == 0)
return 0;
(*pp) = strchr(&p[1], (*cp));
return 1;
}
static inline void
swapp (char ***ppap, char ***ppbp, char **cpap, char **cpbp)
static inline void swapp(char ***ppap, char ***ppbp, char **cpap, char **cpbp)
{
char **pp;
char *p;
@@ -54,8 +56,7 @@ swapp (char ***ppap, char ***ppbp, char **cpap, char **cpbp)
*cpbp = p;
}
char *
nongnu_strcasestr (const char *s, const char *q)
char *nongnu_strcasestr(const char *s, const char *q)
{
size_t qn;
@@ -113,3 +114,5 @@ nongnu_strcasestr (const char *s, const char *q)
return NULL;
}
#endif