Introduce lwip_toupper and use it in netbiosns.c

This fixes build error when LWIP_NO_CTYPE_H=1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Axel Lin 2018-06-27 23:16:03 +08:00
parent a56e61c942
commit 4027a2ae58
2 changed files with 3 additions and 1 deletions

View File

@ -499,7 +499,7 @@ netbiosns_set_name(const char *hostname)
/* make name into upper case */
for (i = 0; i < copy_len; i++ ) {
netbiosns_local_name[i] = (char)toupper((unsigned char)hostname[i]);
netbiosns_local_name[i] = (char)lwip_toupper(hostname[i]);
}
netbiosns_local_name[copy_len] = '\0';
}

View File

@ -223,6 +223,7 @@ typedef int ssize_t;
#define lwip_isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || (c) == '\t' || (c) == '\v')
#define lwip_isupper(c) lwip_in_range((c), 'A', 'Z')
#define lwip_tolower(c) (lwip_isupper(c) ? (c) - 'A' + 'a' : c)
#define lwip_toupper(c) (lwip_islower(c) ? (c) - 'a' + 'A' : c)
#else
#include <ctype.h>
#define lwip_isdigit(c) isdigit((unsigned char)(c))
@ -230,6 +231,7 @@ typedef int ssize_t;
#define lwip_islower(c) islower((unsigned char)(c))
#define lwip_isspace(c) isspace((unsigned char)(c))
#define lwip_tolower(c) tolower((unsigned char)(c))
#define lwip_toupper(c) toupper((unsigned char)(c))
#endif
/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */