Avoid redefinition warnings from strdup functions (#67)

This commit is contained in:
Toni 2021-12-11 01:57:07 +01:00 committed by GitHub
parent 353c68c3df
commit 62320462f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

2
toml.c
View File

@ -65,6 +65,7 @@ static void* CALLOC(size_t nmemb, size_t sz)
} }
#undef strdup
#define strdup(x) error:do-not-use---use-STRDUP-instead #define strdup(x) error:do-not-use---use-STRDUP-instead
static char* STRDUP(const char* s) static char* STRDUP(const char* s)
{ {
@ -77,6 +78,7 @@ static char* STRDUP(const char* s)
return p; return p;
} }
#undef strndup
#define strndup(x) error:do-not-use---use-STRNDUP-instead #define strndup(x) error:do-not-use---use-STRNDUP-instead
static char* STRNDUP(const char* s, size_t n) static char* STRNDUP(const char* s, size_t n)
{ {