X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftdb.h;h=b44daa3eb00f78f6ab12f9a1185c225634ef0cd3;hp=020cf050b803cd02db67d7d34aaa7cd8e042da33;hb=97648992fdd50535fe276261368c179df993202b;hpb=95bf6d3f652c031e1bf4a2ef5df187b6f34a4c01 diff --git a/ccan/tdb/tdb.h b/ccan/tdb/tdb.h index 020cf050..b44daa3e 100644 --- a/ccan/tdb/tdb.h +++ b/ccan/tdb/tdb.h @@ -38,6 +38,7 @@ extern "C" { /* For sig_atomic_t. */ #include #endif +#include /* flags to tdb_store() */ #define TDB_REPLACE 1 /* Unused */ @@ -74,23 +75,11 @@ typedef struct TDB_DATA { size_t dsize; } TDB_DATA; -#ifndef PRINTF_ATTRIBUTE -#if (__GNUC__ >= 3) -/** Use gcc attribute to check printf fns. a1 is the 1-based index of - * the parameter containing the format, and a2 the index of the first - * argument. Note that some gcc 2.x versions don't handle this - * properly **/ -#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) -#else -#define PRINTF_ATTRIBUTE(a1, a2) -#endif -#endif - /* this is the context structure that is returned from a db open */ typedef struct tdb_context TDB_CONTEXT; typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *); -typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4); +typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_FMT(3, 4); typedef unsigned int (*tdb_hash_func)(TDB_DATA *key); struct tdb_logging_context { @@ -175,6 +164,7 @@ void tdb_dump_all(struct tdb_context *tdb); int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); int tdb_freelist_size(struct tdb_context *tdb); +char *tdb_summary(struct tdb_context *tdb); extern TDB_DATA tdb_null;