tdb2: clean up logging
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 1 Dec 2010 12:41:51 +0000 (23:11 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 1 Dec 2010 12:41:51 +0000 (23:11 +1030)
commit4e185ad8ab5a7e01edbbe12d11eb2f1577de7e8b
tree8a8d669373d62d0e049b5780cb8777ecc2352bf4
parent576802602c19ed3cfda98414ffc9b118c2675931
tdb2: clean up logging

Logged errors should always set tdb->ecode before they are called, and
there's little reason to have a sprintf-style logging function since
we can do the formatting internally.

Change the tdb_log attribute to just take a "const char *", and create
a new tdb_logerr() helper which sets ecode and calls it.  As a bonus,
mark it COLD so the compiler can optimize appropriately knowing that
it's unlikely to be invoked.
15 files changed:
ccan/tdb2/check.c
ccan/tdb2/free.c
ccan/tdb2/hash.c
ccan/tdb2/io.c
ccan/tdb2/lock.c
ccan/tdb2/private.h
ccan/tdb2/summary.c
ccan/tdb2/tdb.c
ccan/tdb2/tdb2.h
ccan/tdb2/test/logging.c
ccan/tdb2/test/logging.h
ccan/tdb2/test/run-001-encode.c
ccan/tdb2/test/run-seed.c
ccan/tdb2/test/run-traverse.c
ccan/tdb2/transaction.c