Skip to content

Commit 3328e7f

Browse files
committed
fix build on MSC
1 parent dcb7fac commit 3328e7f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/parser.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,31 @@ comment_options_parser(char *str, plpgsql_check_info *cinfo)
13301330
while (_token);
13311331
}
13321332

1333+
#ifdef _MSC_VER
1334+
1335+
static void *
1336+
memmem(const void *haystack, size_t haystack_len,
1337+
const void * const needle, const size_t needle_len)
1338+
{
1339+
if (haystack == NULL) return NULL; // or assert(haystack != NULL);
1340+
if (haystack_len == 0) return NULL;
1341+
if (needle == NULL) return NULL; // or assert(needle != NULL);
1342+
if (needle_len == 0) return NULL;
1343+
1344+
for (const char *h = haystack;
1345+
haystack_len >= needle_len;
1346+
++h, --haystack_len)
1347+
{
1348+
if (!memcmp(h, needle, needle_len))
1349+
{
1350+
return h;
1351+
}
1352+
}
1353+
return NULL;
1354+
}
1355+
1356+
#endif
1357+
13331358
static void
13341359
comment_options_parsecontent(char *str, size_t bytes, plpgsql_check_info *cinfo)
13351360
{

0 commit comments

Comments
 (0)