X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftypesafe_cb%2F_info;h=b4f379dd48b020c29bf8f27c8da88a37831e619a;hb=9b3f4ef6eec6a5981dcaa62f45da49b8f4f95388;hp=fea27116263c1a6ba52fbc5175a4c65c56772777;hpb=1fe7f55b1efc5deefb20815a03b56c8ef0f6dc53;p=ccan diff --git a/ccan/typesafe_cb/_info b/ccan/typesafe_cb/_info index fea27116..b4f379dd 100644 --- a/ccan/typesafe_cb/_info +++ b/ccan/typesafe_cb/_info @@ -1,11 +1,11 @@ +#include "config.h" #include #include -#include "config.h" /** * typesafe_cb - macros for safe callbacks. * - * The basis of the typesafe_cb header is cast_if_type(): a + * The basis of the typesafe_cb header is typesafe_cb_cast(): a * conditional cast macro. If an expression exactly matches a given * type, it is cast to the target type, otherwise it is left alone. * @@ -35,15 +35,16 @@ * the exactly correct function type to match the argument, or a * function which takes a void *. * - * This is where typesafe_cb() comes in: it uses cast_if_type() to + * This is where typesafe_cb() comes in: it uses typesafe_cb_cast() to * cast the callback function if it matches the argument type: * * void _register_callback(void (*cb)(void *arg), void *arg); * #define register_callback(cb, arg) \ - * _register_callback(typesafe_cb(void, (cb), (arg)), (arg)) + * _register_callback(typesafe_cb(void, void *, (cb), (arg)), \ + * (arg)) * * On compilers which don't support the extensions required - * cast_if_type() and friend become an unconditional cast, so your + * typesafe_cb_cast() and friend become an unconditional cast, so your * code will compile but you won't get type checking. * * Example: @@ -72,7 +73,8 @@ * } * #define register_callback(value, cb, arg) \ * _register_callback(value, \ - * typesafe_cb_preargs(int, (cb), (arg), int),\ + * typesafe_cb_preargs(int, void *, \ + * (cb), (arg), int),\ * (arg)) * * static struct callback *find_callback(int value) @@ -104,7 +106,7 @@ * // Silly game to find the longest chain of values. * int main(int argc, char *argv[]) * { - * int i, run = 1, num = argv[1] ? atoi(argv[1]) : 0; + * int i, run = 1, num = argc > 1 ? atoi(argv[1]) : 0; * * for (i = 1; i < 1024;) { * // Since run is an int, compiler checks "add" does too. @@ -133,7 +135,7 @@ * return 0; * } * - * Licence: LGPL (2 or any later version) + * License: CC0 (Public domain) * Author: Rusty Russell */ int main(int argc, char *argv[])