summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-07-04 16:13:34 +0100
committerEric Engestrom <[email protected]>2019-07-19 22:39:38 +0100
commit6f8b5872ab9238a3b3965c43edb6a5c9192d470d (patch)
treee58af19bc0af2d6b81d3c90b4bad8b1437b8fca4
parent085c3abf27082f72978e011a652a5ece2f518099 (diff)
util: drop strncat(), strcmp(), strncmp(), snprintf() & vsnprintf() MSVC fallbacks
It would seem MSVC>=2015 is now C99-compliant wrt these functions: strncat: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncat-strncat-l-wcsncat-wcsncat-l-mbsncat-mbsncat-l?view=vs-2017 strcmp: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-wcscmp-mbscmp?view=vs-2017 strncmp: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l?view=vs-2017 snprintf: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2017 vsnprintf: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l?view=vs-2017 Suggested-by: Emil Velikov <[email protected]> Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/util/u_string.h81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/util/u_string.h b/src/util/u_string.h
index 055d769fe13..499894b9f94 100644
--- a/src/util/u_string.h
+++ b/src/util/u_string.h
@@ -65,37 +65,6 @@ util_strchrnul(const char *s, char c)
#ifdef _WIN32
-#define vsnprintf util_vsnprintf
-static inline int
-util_vsnprintf(char *str, size_t size, const char *format, va_list ap)
-{
- /* We need to use _vscprintf to calculate the length as vsnprintf returns -1
- * if the number of characters to write is greater than count.
- */
- va_list ap_copy;
- int ret;
- va_copy(ap_copy, ap);
- ret = _vsnprintf(str, size, format, ap);
- if (ret < 0) {
- ret = _vscprintf(format, ap_copy);
- }
- va_end(ap_copy);
- return ret;
-}
-
-#define snprintf util_snprintf
-static inline int
- PRINTFLIKE(3, 4)
-util_snprintf(char *str, size_t size, const char *format, ...)
-{
- va_list ap;
- int ret;
- va_start(ap, format);
- ret = vsnprintf(str, size, format, ap);
- va_end(ap);
- return ret;
-}
-
#define sprintf util_sprintf
static inline void
PRINTFLIKE(2, 3)
@@ -129,56 +98,6 @@ util_vasprintf(char **ret, const char *format, va_list ap)
return vsnprintf(*ret, r + 1, format, ap);
}
-#define strncat util_strncat
-static inline char*
-util_strncat(char *dst, const char *src, size_t n)
-{
- char *p = dst + strlen(dst);
- const char *q = src;
- size_t i;
-
- for (i = 0; i < n && *q != '\0'; ++i)
- *p++ = *q++;
- *p = '\0';
-
- return dst;
-}
-
-#define strcmp util_strcmp
-static inline int
-util_strcmp(const char *s1, const char *s2)
-{
- unsigned char u1, u2;
-
- while (1) {
- u1 = (unsigned char) *s1++;
- u2 = (unsigned char) *s2++;
- if (u1 != u2)
- return u1 - u2;
- if (u1 == '\0')
- return 0;
- }
- return 0;
-}
-
-#define strncmp util_strncmp
-static inline int
-util_strncmp(const char *s1, const char *s2, size_t n)
-{
- unsigned char u1, u2;
-
- while (n-- > 0) {
- u1 = (unsigned char) *s1++;
- u2 = (unsigned char) *s2++;
- if (u1 != u2)
- return u1 - u2;
- if (u1 == '\0')
- return 0;
- }
- return 0;
-}
-
-
#define strcasecmp stricmp
#define strdup _strdup