Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org 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;
FREE_AND_NULL(h);
FREE_AND_NULL(n);
if(p == NULL)
return NULL;
return (char*)haystack + offset;
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;
}
#endif
......
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