Commit 9550eb2d authored by Michael Graff's avatar Michael Graff
Browse files

add formatcheck.h

parent ac259437
......@@ -24,7 +24,8 @@ top_srcdir = @top_srcdir@
#
HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.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 \
mutexblock.h netaddr.h ondestroy.h platform.h \
print.h quota.h random.h ratelimiter.h region.h \
......
/*
* 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 */
......@@ -15,7 +15,7 @@
* 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
#define ISC_LOG_H 1
......@@ -24,22 +24,12 @@
#include <stdarg.h>
#include <syslog.h> /* XXXDCL NT */
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/types.h>
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.
*
......
......@@ -22,6 +22,7 @@
*** Imports
***/
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/platform.h>
......@@ -36,11 +37,13 @@
ISC_LANG_BEGINDECLS
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
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
ISC_LANG_ENDDECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment