diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-03-02 01:14:08 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-03-02 01:14:08 +0100 |
commit | 72119afe00e25af5e9378587e939c3677d8c146f (patch) | |
tree | 6ca9953e98d8d7aa7816fbbbfe834b4bf226376c | |
parent | 776d15d38359255434f5d55722430dfcb7b3eba5 (diff) | |
download | libxml2-72119afe00e25af5e9378587e939c3677d8c146f.tar.gz |
Don't check for standard C89 library functions
Don't check for
- fprintf
- localtime
- printf
- rand
- sprintf
- srand
- sscanf
- strftime
- time
- vfprintf
- vsprintf
If the C99 functions snprintf and vsnprintf are missing, Trio is
enabled.
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | config.h.cmake.in | 39 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | dict.c | 3 | ||||
-rw-r--r-- | hash.c | 3 | ||||
-rw-r--r-- | libxml.h | 2 | ||||
-rw-r--r-- | os400/os400config.h.in | 48 | ||||
-rwxr-xr-x | vms/config.vms | 15 | ||||
-rw-r--r-- | xmlmemory.c | 4 |
9 files changed, 6 insertions, 130 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7987ecbb..d6794148 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,6 @@ else() check_include_files(dl.h HAVE_DL_H) check_include_files(fcntl.h HAVE_FCNTL_H) check_function_exists(fpclass HAVE_FPCLASS) - check_function_exists(fprintf HAVE_FPRINTF) check_function_exists(ftime HAVE_FTIME) check_function_exists(getaddrinfo HAVE_GETADDRINFO) check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) @@ -173,26 +172,18 @@ else() check_function_exists(isascii HAVE_ISASCII) check_library_exists(history append_history "" HAVE_LIBHISTORY) check_library_exists(readline readline "" HAVE_LIBREADLINE) - check_function_exists(localtime HAVE_LOCALTIME) check_function_exists(mmap HAVE_MMAP) check_function_exists(munmap HAVE_MUNMAP) check_include_files(netdb.h HAVE_NETDB_H) check_include_files(netinet/in.h HAVE_NETINET_IN_H) check_include_files(poll.h HAVE_POLL_H) - check_function_exists(printf HAVE_PRINTF) check_include_files(pthread.h HAVE_PTHREAD_H) check_function_exists(putenv HAVE_PUTENV) - check_function_exists(rand HAVE_RAND) check_function_exists(rand_r HAVE_RAND_R) check_include_files(resolv.h HAVE_RESOLV_H) check_library_exists(dld shl_load "" HAVE_SHLLOAD) - check_function_exists(snprintf HAVE_SNPRINTF) - check_function_exists(sprintf HAVE_SPRINTF) - check_function_exists(srand HAVE_SRAND) - check_function_exists(sscanf HAVE_SSCANF) check_function_exists(stat HAVE_STAT) check_include_files(stdint.h HAVE_STDINT_H) - check_function_exists(strftime HAVE_STRFTIME) check_include_files(sys/mman.h HAVE_SYS_MMAN_H) check_include_files(sys/select.h HAVE_SYS_SELECT_H) check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) @@ -200,12 +191,8 @@ else() check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(sys/types.h HAVE_SYS_TYPES_H) - check_function_exists(time HAVE_TIME) check_include_files(unistd.h HAVE_UNISTD_H) check_function_exists(va_copy HAVE_VA_COPY) - check_function_exists(vfprintf HAVE_VFPRINTF) - check_function_exists(vsnprintf HAVE_VSNPRINTF) - check_function_exists(vsprintf HAVE_VSPRINTF) check_function_exists(__va_copy HAVE___VA_COPY) check_c_source_compiles(" #include <stdlib.h> diff --git a/config.h.cmake.in b/config.h.cmake.in index bdbc50be..bb9d340d 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -28,9 +28,6 @@ /* Define to 1 if you have the <fcntl.h> header file. */ #cmakedefine HAVE_FCNTL_H 1 -/* Define to 1 if you have the `fprintf' function. */ -#cmakedefine HAVE_FPRINTF 1 - /* Define to 1 if you have the `ftime' function. */ #cmakedefine HAVE_FTIME 1 @@ -52,9 +49,6 @@ /* Define if readline library is there (-lreadline) */ #cmakedefine HAVE_LIBREADLINE 1 -/* Define to 1 if you have the `localtime' function. */ -#cmakedefine HAVE_LOCALTIME 1 - /* Define to 1 if you have the `mmap' function. */ #cmakedefine HAVE_MMAP 1 @@ -75,18 +69,12 @@ /* Define to 1 if you have the <poll.h> header file. */ #cmakedefine HAVE_POLL_H 1 -/* Define to 1 if you have the `printf' function. */ -#cmakedefine HAVE_PRINTF 1 - /* Define if <pthread.h> is there */ #cmakedefine HAVE_PTHREAD_H 1 /* Define to 1 if you have the `putenv' function. */ #cmakedefine HAVE_PUTENV 1 -/* Define to 1 if you have the `rand' function. */ -#cmakedefine HAVE_RAND 1 - /* Define to 1 if you have the `rand_r' function. */ #cmakedefine HAVE_RAND_R 1 @@ -96,27 +84,12 @@ /* Have shl_load based dso */ #cmakedefine HAVE_SHLLOAD 1 -/* Define to 1 if you have the `snprintf' function. */ -#cmakedefine HAVE_SNPRINTF 1 - -/* Define to 1 if you have the `sprintf' function. */ -#cmakedefine HAVE_SPRINTF 1 - -/* Define to 1 if you have the `srand' function. */ -#cmakedefine HAVE_SRAND 1 - -/* Define to 1 if you have the `sscanf' function. */ -#cmakedefine HAVE_SSCANF 1 - /* Define to 1 if you have the `stat' function. */ #cmakedefine HAVE_STAT 1 /* Define to 1 if you have the <stdint.h> header file. */ #cmakedefine HAVE_STDINT_H 1 -/* Define to 1 if you have the `strftime' function. */ -#cmakedefine HAVE_STRFTIME 1 - /* Define to 1 if you have the <sys/mman.h> header file. */ #cmakedefine HAVE_SYS_MMAN_H 1 @@ -138,24 +111,12 @@ /* Define to 1 if you have the <sys/types.h> header file. */ #cmakedefine HAVE_SYS_TYPES_H 1 -/* Define to 1 if you have the `time' function. */ -#cmakedefine HAVE_TIME 1 - /* Define to 1 if you have the <unistd.h> header file. */ #cmakedefine HAVE_UNISTD_H 1 /* Whether va_copy() is available */ #cmakedefine HAVE_VA_COPY 1 -/* Define to 1 if you have the `vfprintf' function. */ -#cmakedefine HAVE_VFPRINTF 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -#cmakedefine HAVE_VSNPRINTF 1 - -/* Define to 1 if you have the `vsprintf' function. */ -#cmakedefine HAVE_VSPRINTF 1 - /* Define to 1 if you have the <zlib.h> header file. */ #cmakedefine HAVE_ZLIB_H 1 diff --git a/configure.ac b/configure.ac index 68d21433..1748b07d 100644 --- a/configure.ac +++ b/configure.ac @@ -502,10 +502,9 @@ AC_TYPE_UINT32_T echo Checking libraries dnl Checks for library functions. -AC_FUNC_STRFTIME -AC_CHECK_FUNCS(strftime localtime gettimeofday ftime) -AC_CHECK_FUNCS(stat signal) -AC_CHECK_FUNCS(rand rand_r srand time) +AC_CHECK_FUNCS(gettimeofday ftime) +AC_CHECK_FUNCS(stat) +AC_CHECK_FUNCS(rand_r) AC_CHECK_FUNCS(isascii mmap munmap putenv) AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */ @@ -1594,7 +1593,7 @@ dnl AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around]) dnl AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around]) dnl and do not redefine those functions is C-source files. dnl -AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,, +AC_CHECK_FUNCS(snprintf vsnprintf,, NEED_TRIO=1) if test "$with_coverage" = "yes" -a "${GCC}" = "yes" @@ -34,8 +34,7 @@ * list we will use the BigKey algo as soon as the hash size grows * over MIN_DICT_SIZE so this actually works */ -#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \ - !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) +#if !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) #define DICT_RANDOMIZATION #endif @@ -29,8 +29,7 @@ * it seems that having hash randomization might be a good idea * when using XML with untrusted data */ -#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \ - !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) +#if !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) #define HASH_RANDOMIZATION #endif @@ -95,12 +95,10 @@ void __xmlGlobalInitMutexDestroy(void); int __xmlInitializeDict(void); -#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) /* * internal thread safe random function */ int __xmlRandom(void); -#endif XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg); int xmlInputReadCallbackNop(void *context, char *buffer, int len); diff --git a/os400/os400config.h.in b/os400/os400config.h.in index 1f79cb7f..4497b07a 100644 --- a/os400/os400config.h.in +++ b/os400/os400config.h.in @@ -27,9 +27,6 @@ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 -/* Define to 1 if you have the `fprintf' function. */ -#undef HAVE_FPRINTF /* Use trio. */ - /* Define to 1 if you have the `ftime' function. */ #undef HAVE_FTIME @@ -51,9 +48,6 @@ /* Define if readline library is there (-lreadline) */ #undef HAVE_LIBREADLINE -/* Define to 1 if you have the `localtime' function. */ -#define HAVE_LOCALTIME 1 - /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP @@ -74,21 +68,12 @@ /* Define to 1 if you have the <poll.h> header file. */ #undef HAVE_POLL_H -/* Define to 1 if you have the `printf' function. */ -#undef HAVE_PRINTF /* Use trio. */ - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF /* Use trio. */ - /* Define if <pthread.h> is there */ #define HAVE_PTHREAD_H 1 /* Define to 1 if you have the `putenv' function. */ #define HAVE_PUTENV 1 -/* Define to 1 if you have the `rand' function. */ -#define HAVE_RAND 1 - /* Define to 1 if you have the `rand_r' function. */ #define HAVE_RAND_R 1 @@ -98,33 +83,12 @@ /* Have shl_load based dso */ #undef HAVE_SHLLOAD -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF /* Use trio. */ - -/* Define to 1 if you have the `sprintf' function. */ -#undef HAVE_SPRINTF /* Use trio. */ - -/* Define to 1 if you have the `srand' function. */ -#define HAVE_SRAND 1 - -/* Define to 1 if you have the `scanf' function. */ -#undef HAVE_SCANF /* Use trio. */ - -/* Define to 1 if you have the `fscanf' function. */ -#undef HAVE_FSCANF /* Use trio. */ - -/* Define to 1 if you have the `sscanf' function. */ -#undef HAVE_SSCANF /* Use trio. */ - /* Define to 1 if you have the `stat' function. */ #define HAVE_STAT 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 -/* Define to 1 if you have the `strftime' function. */ -#define HAVE_STRFTIME 1 - /* Define to 1 if you have the <sys/mman.h> header file. */ #define HAVE_SYS_MMAN_H 1 @@ -146,24 +110,12 @@ /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 -/* Define to 1 if you have the `time' function. */ -#define HAVE_TIME 1 - /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 /* Whether va_copy() is available */ #undef HAVE_VA_COPY -/* Define to 1 if you have the `vfprintf' function. */ -#undef HAVE_VFPRINTF /* Use trio. */ - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF /* Use trio. */ - -/* Define to 1 if you have the `vsprintf' function. */ -#undef HAVE_VSPRINTF /* Use trio. */ - /* Whether __va_copy() is available */ #undef HAVE___VA_COPY diff --git a/vms/config.vms b/vms/config.vms index 1277114c..b7a2fc87 100755 --- a/vms/config.vms +++ b/vms/config.vms @@ -2,9 +2,6 @@ #define VMS 1 -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -16,15 +13,6 @@ #define ICONV_CONST -/* Define if you have the localtime function. */ -#define HAVE_LOCALTIME 1 - -/* Define if you have the snprintf function. */ -#undef HAVE_SNPRINTF - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - /* Define if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H @@ -37,9 +25,6 @@ /* Define if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H -/* Define to 1 if you have the `strftime' function. */ -#define HAVE_STRFTIME 1 - /* Define if you have the <sys/mman.h> header file. */ #undef HAVE_SYS_MMAN_H diff --git a/xmlmemory.c b/xmlmemory.c index efee14dd..eeb76c37 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -746,12 +746,10 @@ xmlMemDisplay(FILE *fp) MEMHDR *p; unsigned idx; int nb = 0; -#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME) time_t currentTime; char buf[500]; struct tm * tstruct; #endif -#endif FILE *old_fp = fp; if (fp == NULL) { @@ -761,12 +759,10 @@ xmlMemDisplay(FILE *fp) } #ifdef MEM_LIST -#if defined(HAVE_LOCALTIME) && defined(HAVE_STRFTIME) currentTime = time(NULL); tstruct = localtime(¤tTime); strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct); fprintf(fp," %s\n\n", buf); -#endif fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", |