check for vsnprintf() during build

QT_SNPRINTF and QT_VSNPRINTF should not be used directly thus removing them

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-11-18 00:58:56 +02:00
parent 3d9d72dffd
commit 550185907b
3 changed files with 5 additions and 13 deletions

View file

@ -365,6 +365,7 @@ katie_check_function(getgrgid_r "grp.h")
katie_check_function(nl_langinfo "langinfo.h")
katie_check_function(getaddrinfo "netdb.h")
katie_check_function(clock_gettime "time.h")
katie_check_function(vsnprintf "stdio.h")
# XSI/POSIX.1-2001
katie_check_function(strerror_r "string.h")
# SUSv2

View file

@ -154,11 +154,6 @@
#define QT_SOCKET_CONNECT ::connect
#define QT_SOCKET_BIND ::bind
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
#define QT_SNPRINTF ::snprintf
#define QT_VSNPRINTF ::vsnprintf
#endif
#define QT_BUFFSIZE BUFSIZ
#endif // include guard

View file

@ -31,15 +31,11 @@
**
****************************************************************************/
#include "qplatformdefs.h"
#include "qbytearray.h"
#include "qstring.h"
#include "string.h"
#ifdef QT_VSNPRINTF
#include <string.h>
#include <stdio.h>
#endif
QT_BEGIN_NAMESPACE
@ -67,7 +63,9 @@ QT_BEGIN_NAMESPACE
int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap)
{
#ifndef QT_VSNPRINTF
#ifdef QT_HAVE_VSNPRINTF
return ::vsnprintf(str, n, fmt, ap);
#else
if (!str || !fmt)
return -1;
@ -83,8 +81,6 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap)
}
return ba.length();
#else
return QT_VSNPRINTF(str, n, fmt, ap);
#endif
}