Cleanup handling of non-standard functions in lwIP

- itoa
- strnicmp, stricmp/strcasecmp
- strnstr
Related to patch #9115: httpd.c: strcasecmp for GCC and stricmp for Windows
This commit is contained in:
Dirk Ziegelmeier
2016-09-28 21:52:11 +02:00
parent f8d19e28de
commit 1f68b32485
8 changed files with 146 additions and 199 deletions

View File

@@ -161,28 +161,6 @@
#define HTTPD_DEBUG_TIMING LWIP_DBG_OFF
#endif
/** Set this to 1 on platforms where strnstr is not available */
#if !defined LWIP_HTTPD_STRNSTR_PRIVATE || defined __DOXYGEN__
#define LWIP_HTTPD_STRNSTR_PRIVATE 1
#endif
/** Set this to 1 on platforms where stricmp is not available */
#if !defined LWIP_HTTPD_STRICMP_PRIVATE || defined __DOXYGEN__
#define LWIP_HTTPD_STRICMP_PRIVATE 0
#endif
/** Define this to a smaller function if you have itoa() at hand... */
#if !defined LWIP_HTTPD_ITOA || defined __DOXYGEN__
#if !defined LWIP_HTTPD_ITOA_PRIVATE || defined __DOXYGEN__
#define LWIP_HTTPD_ITOA_PRIVATE 1
#endif
#if LWIP_HTTPD_ITOA_PRIVATE
#define LWIP_HTTPD_ITOA(buffer, bufsize, number) httpd_itoa(number, buffer)
#else
#define LWIP_HTTPD_ITOA(buffer, bufsize, number) snprintf(buffer, bufsize, "%d", number)
#endif
#endif
/** Set this to one to show error pages when parsing a request fails instead
of simply closing the connection. */
#if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__

View File

@@ -40,16 +40,6 @@
* @{
*/
/** Since there's no standard function for case-insensitive string comparision,
* we need another define here:
* define this to stricmp() for windows or strcasecmp() for linux.
* If not defined, comparision is case sensitive and the provided hostname must be
* uppercase.
*/
#if !defined NETBIOS_STRCMP || defined __DOXYGEN__
#define NETBIOS_STRCMP(str1, str2) strcmp(str1, str2)
#endif
/** NetBIOS name of lwip device
* This must be uppercase until NETBIOS_STRCMP() is defined to a string
* comparision function that is case insensitive.

View File

@@ -133,9 +133,26 @@ u32_t lwip_ntohl(u32_t x);
#endif /* BYTE_ORDER == BIG_ENDIAN */
/* Functions that are not available as standard implementations.
* In lwipopts.h, you can #define these to implementations available on
* your platform to save some code bytes if you use these functions
* in your application, too.
*/
#ifndef lwip_itoa
void lwip_itoa(int value, char* result);
#endif
#ifndef lwip_strnicmp
int lwip_strnicmp(const char* str1, const char* str2, size_t len);
#endif
#ifndef lwip_stricmp
int lwip_stricmp(const char* str1, const char* str2);
#endif
#ifndef lwip_strnstr
char* lwip_strnstr(const char* buffer, const char* token, size_t n);
#endif
#ifdef __cplusplus
}
#endif
#endif /* LWIP_HDR_DEF_H */