X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fstrmap%2F_info;h=eba8fe444ae78e1119e03644ab0f55d29d1d4d23;hb=4e94428ea403f94679ad20e648424bf30464890a;hp=82f20d13fa2bfe7a6b09d3b4451fe583e3ee1e0d;hpb=bb2a75f445f408e43730fc55a1a978581ebe9b96;p=ccan diff --git a/ccan/strmap/_info b/ccan/strmap/_info index 82f20d13..eba8fe44 100644 --- a/ccan/strmap/_info +++ b/ccan/strmap/_info @@ -1,5 +1,6 @@ -#include #include "config.h" +#include +#include /** * strmap - an ordered map of strings to values @@ -9,16 +10,17 @@ * http://cr.yp.to/critbit.html * http://github.com/agl/critbit (which this code is based on) * - * License: Public domain (but some dependencies are LGPL!) + * License: CC0 (but some dependencies are LGPL!) * Author: Rusty Russell * Ccanlint: * license_depends_compat FAIL * * Example: + * #include * #include * #include * - * static bool dump(const char *member, size_t value, void *unused) + * static bool dump(const char *member, size_t value, void *unused UNNEEDED) * { * printf("%s at %zu. ", member, value); * // true means keep going with iteration. @@ -28,10 +30,10 @@ * int main(int argc, char *argv[]) * { * size_t i; - * struct { STRMAP_MEMBERS(size_t); } map; + * STRMAP(size_t) map; * * strmap_init(&map); - * for (i = 1; i < argc; i++) + * for (i = 1; i < (size_t)argc; i++) * // This only adds the first time for this arg. * strmap_add(&map, argv[i], i); * @@ -39,9 +41,9 @@ * printf("\n"); * return 0; * } - * // Given 'foo' outputs 'foo at 1. ' - * // Given 'foo bar' outputs 'bar at 2. foo at 1. ' - * // Given 'foo foo bar zebra' outputs 'bar at 3. foo at 1. zebra at 4. ' + * // Given "foo" outputs "foo at 1. \n" + * // Given "foo bar" outputs "bar at 2. foo at 1. \n" + * // Given "foo foo bar zebra" outputs "bar at 3. foo at 1. zebra at 4. \n" */ int main(int argc, char *argv[]) {