Fix cplusplus linkage error with extern C

This commit is contained in:
Matt Rippa
2022-03-29 19:12:10 -10:00
committed by Dirk Zimoch
parent c123c5c8f7
commit fc67fb8721

View File

@ -52,11 +52,15 @@
#if defined(vxWorks) || defined(__rtems__)
// These systems have no strncasecmp at the moment
// But avoid compiler errors in case strncasecmp exists in future versions
static int mystrncasecmp(const char *s1, const char *s2, size_t n)
{
int r=0;
while (n && (r = toupper(*s1)-toupper(*s2)) == 0) { n--; s1++; s2++; };
return r;
extern "C" {
static int mystrncasecmp(const char *s1, const char *s2, size_t n)
{
int r=0;
while (n && (r = toupper(*s1)-toupper(*s2)) == 0) { n--; s1++; s2++; };
return r;
}
}
#define strncasecmp mystrncasecmp
#endif