2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

add formatcheck.h

This commit is contained in:
Michael Graff
2000-06-19 21:45:05 +00:00
parent ac259437c5
commit 9550eb2dab
4 changed files with 41 additions and 15 deletions

View File

@@ -24,7 +24,8 @@ top_srcdir = @top_srcdir@
# #
HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \ HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \
bufferlist.h commandline.h error.h event.h eventclass.h \ bufferlist.h commandline.h error.h event.h eventclass.h \
file.h heap.h interfaceiter.h @ISC_IPV6_H@ lang.h lex.h \ file.h formatcheck.h heap.h interfaceiter.h \
@ISC_IPV6_H@ lang.h lex.h \
lfsr.h lib.h list.h log.h magic.h md5.h mem.h msgcat.h \ lfsr.h lib.h list.h log.h magic.h md5.h mem.h msgcat.h \
mutexblock.h netaddr.h ondestroy.h platform.h \ mutexblock.h netaddr.h ondestroy.h platform.h \
print.h quota.h random.h ratelimiter.h region.h \ print.h quota.h random.h ratelimiter.h region.h \

View File

@@ -0,0 +1,32 @@
/*
* Copyright (C) 1999, 2000 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef ISC_FORMATCHECK_H
#define ISC_FORMATCHECK_H 1
/*
* fmt is the location of the format string parameter.
* args is the location of the first argument (or 0 for no argument checking).
* Note: the first parameter is 1, not 0.
*/
#ifdef __GNUC__
#define ISC_FORMAT_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args)))
#else
#define ISC_FORMAT_PRINTF(fmt, args)
#endif
#endif /* ISC_FORMATCHECK_H */

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: log.h,v 1.24 2000/06/19 19:18:45 tale Exp $ */ /* $Id: log.h,v 1.25 2000/06/19 21:45:03 explorer Exp $ */
#ifndef ISC_LOG_H #ifndef ISC_LOG_H
#define ISC_LOG_H 1 #define ISC_LOG_H 1
@@ -24,22 +24,12 @@
#include <stdarg.h> #include <stdarg.h>
#include <syslog.h> /* XXXDCL NT */ #include <syslog.h> /* XXXDCL NT */
#include <isc/formatcheck.h>
#include <isc/lang.h> #include <isc/lang.h>
#include <isc/types.h> #include <isc/types.h>
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS
/*
* fmt is the location of the format string parameter.
* args is the location of the first argument (or 0 for no argument checking).
* Note: the first parameter is 1, not 0.
*/
#ifdef __GNUC__
#define ISC_FORMAT_PRINTF(fmt, args) __attribute__((format(printf, fmt, args)))
#else
#define ISC_FORMAT_PRINTF(fmt, args)
#endif
/* /*
* Severity levels, patterned after Unix's syslog levels. * Severity levels, patterned after Unix's syslog levels.
* *

View File

@@ -22,6 +22,7 @@
*** Imports *** Imports
***/ ***/
#include <isc/formatcheck.h>
#include <isc/lang.h> #include <isc/lang.h>
#include <isc/platform.h> #include <isc/platform.h>
@@ -36,11 +37,13 @@
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS
int int
isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap); isc_print_vsnprintf(char *str, size_t size, const char *format, va_list ap)
ISC_FORMAT_PRINTF(3, 0);
#define vsnprintf isc_print_vsnprintf #define vsnprintf isc_print_vsnprintf
int int
isc_print_snprintf(char *str, size_t size, const char *format, ...); isc_print_snprintf(char *str, size_t size, const char *format, ...)
ISC_FORMAT_PRINTF(3, 4);
#define snprintf isc_print_snprintf #define snprintf isc_print_snprintf
ISC_LANG_ENDDECLS ISC_LANG_ENDDECLS