Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:11

0001 #ifndef CURLINC_MPRINTF_H
0002 #define CURLINC_MPRINTF_H
0003 /***************************************************************************
0004  *                                  _   _ ____  _
0005  *  Project                     ___| | | |  _ \| |
0006  *                             / __| | | | |_) | |
0007  *                            | (__| |_| |  _ <| |___
0008  *                             \___|\___/|_| \_\_____|
0009  *
0010  * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
0011  *
0012  * This software is licensed as described in the file COPYING, which
0013  * you should have received as part of this distribution. The terms
0014  * are also available at https://curl.se/docs/copyright.html.
0015  *
0016  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
0017  * copies of the Software, and permit persons to whom the Software is
0018  * furnished to do so, under the terms of the COPYING file.
0019  *
0020  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
0021  * KIND, either express or implied.
0022  *
0023  * SPDX-License-Identifier: curl
0024  *
0025  ***************************************************************************/
0026 
0027 #include <stdarg.h>
0028 #include <stdio.h> /* needed for FILE */
0029 #include "curl.h"  /* for CURL_EXTERN */
0030 
0031 #ifdef  __cplusplus
0032 extern "C" {
0033 #endif
0034 
0035 #ifndef CURL_TEMP_PRINTF
0036 #if (defined(__GNUC__) || defined(__clang__) ||                         \
0037   defined(__IAR_SYSTEMS_ICC__)) &&                                      \
0038   defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) &&         \
0039   !defined(CURL_NO_FMT_CHECKS)
0040 #if defined(__MINGW32__) && !defined(__clang__)
0041 #if defined(__MINGW_PRINTF_FORMAT)  /* mingw-w64 3.0.0+. Needs stdio.h. */
0042 #define CURL_TEMP_PRINTF(fmt, arg) \
0043   __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, arg)))
0044 #else
0045 #define CURL_TEMP_PRINTF(fmt, arg)
0046 #endif
0047 #else
0048 #define CURL_TEMP_PRINTF(fmt, arg) \
0049   __attribute__((format(printf, fmt, arg)))
0050 #endif
0051 #else
0052 #define CURL_TEMP_PRINTF(fmt, arg)
0053 #endif
0054 #endif
0055 
0056 CURL_EXTERN int curl_mprintf(const char *format, ...)
0057   CURL_TEMP_PRINTF(1, 2);
0058 CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...)
0059   CURL_TEMP_PRINTF(2, 3);
0060 CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...)
0061   CURL_TEMP_PRINTF(2, 3);
0062 CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
0063                                const char *format, ...)
0064   CURL_TEMP_PRINTF(3, 4);
0065 CURL_EXTERN int curl_mvprintf(const char *format, va_list args)
0066   CURL_TEMP_PRINTF(1, 0);
0067 CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args)
0068   CURL_TEMP_PRINTF(2, 0);
0069 CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args)
0070   CURL_TEMP_PRINTF(2, 0);
0071 CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
0072                                 const char *format, va_list args)
0073   CURL_TEMP_PRINTF(3, 0);
0074 CURL_EXTERN char *curl_maprintf(const char *format, ...)
0075   CURL_TEMP_PRINTF(1, 2);
0076 CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args)
0077   CURL_TEMP_PRINTF(1, 0);
0078 
0079 #undef CURL_TEMP_PRINTF
0080 
0081 #ifdef  __cplusplus
0082 } /* end of extern "C" */
0083 #endif
0084 
0085 #endif /* CURLINC_MPRINTF_H */