mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +00:00
introduce 'lwip_tolower' and use it in dns.c
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
parent
66f7f06601
commit
a9d6ea5953
@ -96,7 +96,6 @@
|
||||
#include "lwip/prot/dns.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/** Random generator function to create random TXIDs and source ports for queries */
|
||||
#ifndef DNS_RAND_TXID
|
||||
@ -667,7 +666,7 @@ dns_compare_name(const char *query, struct pbuf *p, u16_t start_offset)
|
||||
if (c < 0) {
|
||||
return 0xFFFF;
|
||||
}
|
||||
if (tolower((*query)) != tolower((u8_t)c)) {
|
||||
if (lwip_tolower((*query)) != lwip_tolower((u8_t)c)) {
|
||||
return 0xFFFF;
|
||||
}
|
||||
if (response_offset == 0xFFFF) {
|
||||
|
@ -221,12 +221,15 @@ typedef int ssize_t;
|
||||
#define lwip_isxdigit(c) (lwip_isdigit(c) || lwip_in_range((c), 'a', 'f') || lwip_in_range((c), 'A', 'F'))
|
||||
#define lwip_islower(c) lwip_in_range((c), 'a', 'z')
|
||||
#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)
|
||||
#else
|
||||
#include <ctype.h>
|
||||
#define lwip_isdigit(c) isdigit((unsigned char)(c))
|
||||
#define lwip_isxdigit(c) isxdigit((unsigned char)(c))
|
||||
#define lwip_islower(c) islower((unsigned char)(c))
|
||||
#define lwip_isspace(c) isspace((unsigned char)(c))
|
||||
#define lwip_tolower(c) tolower(c)
|
||||
#endif
|
||||
|
||||
/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */
|
||||
|
Loading…
Reference in New Issue
Block a user