Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, for more info) to build successfully.

Commit a46e8164 authored by rswindell's avatar rswindell

Less heavy brute-force version of strcaststr() for Windows (i.e. no mallocs).

parent fa530beb
......@@ -84,20 +84,14 @@ int DLLCALL safe_snprintf(char *dst, size_t size, const char *fmt, ...)
char* DLLCALL strcasestr(const char* haystack, const char* needle)
char* p = NULL;
/* temporary performance hack begin (warning: different behavior from traditional strcasestr): */
if((p = strstr(haystack, needle)) != NULL)
return p;
char* h = strdup(haystack);
char* n = strdup(needle);
if(h != NULL && n != NULL)
p = strstr(strupr(h), strupr(n));
int offset = p - h;
if(p == NULL)
const char* p;
size_t len = strlen(needle);
for(p = haystack; *p != '\0'; p++) {
if(strnicmp(p, needle, len) == 0)
return (char*)p;
return NULL;
return (char*)haystack + offset;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment