File tree Expand file tree Collapse file tree 1 file changed +27
-4
lines changed
Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change 99#include "sqlite-vector.h"
1010#include "distance-cpu.h"
1111
12- #ifdef _WIN32
13- #define _GNU_SOURCE
14- #endif
15-
1612#include <math.h>
1713#include <stdio.h>
1814#include <ctype.h>
2420#include <stdbool.h>
2521#include <stddef.h>
2622
23+ #ifdef _WIN32
24+ char * strcasestr (const char * haystack , const char * needle ) {
25+ if (!haystack || !needle ) {
26+ return NULL ;
27+ }
28+
29+ if (* needle == '\0' ) {
30+ return (char * )haystack ;
31+ }
32+
33+ size_t needle_len = strlen (needle );
34+ size_t haystack_len = strlen (haystack );
35+
36+ if (needle_len > haystack_len ) {
37+ return NULL ;
38+ }
39+
40+ for (size_t i = 0 ; i <= haystack_len - needle_len ; i ++ ) {
41+ if (strnicmp (haystack + i , needle , needle_len ) == 0 ) {
42+ return (char * )(haystack + i );
43+ }
44+ }
45+
46+ return NULL ;
47+ }
48+ #endif
49+
2750#if defined(_WIN32 ) || defined(__linux__ )
2851#include <float.h>
2952#endif
You can’t perform that action at this time.
0 commit comments