diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2021-02-27 07:17:11 +0000 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-02-28 22:03:42 +0000 |
commit | 73d793788ce631ac1c63bf2a0071d3d3e3351213 (patch) | |
tree | 651f8452d4918e3e0a4bb3858f13a853da4ec9df /wsutil | |
parent | 670fab2ce5451c6b73f9bb6fd01fec733b6df3c4 (diff) |
Remove and replace obsolete ws_snprintf() definition
Since fe94133f0d06935bb5f2afe21f59bbb078d3d9d3 ws_snprintf()
and ws_vsnprintf() don't actually do anything anymore.
The return value of ws_[v]snprintf was discarded before,
now it too conforms to C99.
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/ws_printf.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/wsutil/ws_printf.h b/wsutil/ws_printf.h index 0a9b9d509e..d84df646b5 100644 --- a/wsutil/ws_printf.h +++ b/wsutil/ws_printf.h @@ -11,58 +11,6 @@ #ifndef __WS_PRINTF_H__ #define __WS_PRINTF_H__ -/* - * GLib's string utility routines are slow on windows, likely due to calling - * g_printf_string_upper_bound. Using ws_snprintf and ws_vsnprintf in hot - * code paths can speed up program execution. Otherwise you're probably safe - * sticking with g_snprintf and g_vsnprintf. - */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifdef _WIN32 -#include <strsafe.h> - -/* The UCRT versions of snprintf and vsnprintf conform to C99 */ - -static __inline void -ws_vsnprintf(char *buffer, size_t size_of_buffer, const char *format, va_list argptr) -{ - vsnprintf(buffer, size_of_buffer, format, argptr); -} - -#else /* _WIN32 */ - -#include <glib.h> - -/* - * Use g_vsnprintf. On Linux and macOS these should be a thin wrapper around - * vsprintf. - */ - -static inline void -ws_vsnprintf(char *buffer, size_t size_of_buffer, const char *format, va_list argptr) -{ - g_vsnprintf(buffer, (gulong) size_of_buffer, format, argptr); -} - -#endif /* _WIN32 */ - -#ifdef _WIN32 -static __inline void -#else -static inline void -#endif -ws_snprintf(char *buffer, size_t size_of_buffer, const char * format, ...) { - va_list argptr; - - va_start(argptr, format); - ws_vsnprintf(buffer, size_of_buffer, format, argptr); - va_end(argptr); -} - /* This is intended to fool checkAPIs.pl for places that have "debugging" (using printf) usually wrapped in an #ifdef, but checkAPIs.pl isn't smart enough to figure that out. @@ -71,8 +19,4 @@ debugging context has a protocol tree. */ #define ws_debug_printf printf -#ifdef __cplusplus -} -#endif /* __cplusplus */ - #endif /* __WS_PRINTF_H__ */ |