X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fhtable%2F_info;h=a3bb76db6bf0395562bfbc96c02e0f9e98e04391;hb=5ff76d983c62c8fc489672a1f89927ee3ba58e5d;hp=6c889d06fc6784510ca42edb183608479217612d;hpb=8fc7a90a8db345c4276419d11f8731afc63f65f5;p=ccan diff --git a/ccan/htable/_info b/ccan/htable/_info index 6c889d06..a3bb76db 100644 --- a/ccan/htable/_info +++ b/ccan/htable/_info @@ -1,3 +1,4 @@ +#include "config.h" #include #include @@ -35,6 +36,7 @@ * // Wrapper for rehash function pointer. * static size_t rehash(const void *e, void *unused) * { + * (void)unused; * return hash_string(((struct name_to_digit *)e)->name); * } * @@ -62,8 +64,8 @@ * * int main(int argc, char *argv[]) * { - * struct htable *ht; - * unsigned int i; + * struct htable ht; + * int i; * unsigned long val; * * if (argc < 2) @@ -71,14 +73,14 @@ * argv[0]); * * // Create and populate hash table. - * ht = htable_new(rehash, NULL); - * for (i = 0; i < sizeof(map)/sizeof(map[0]); i++) - * htable_add(ht, hash_string(map[i].name), &map[i]); + * htable_init(&ht, rehash, NULL); + * for (i = 0; i < (int)(sizeof(map)/sizeof(map[0])); i++) + * htable_add(&ht, hash_string(map[i].name), &map[i]); * * // Add any aliases to the hash table. * for (i = 1; i < argc; i++) { * if (!strncmp(argv[i], "--alias=", strlen("--alias="))) - * add_alias(ht, argv[i] + strlen("--alias=")); + * add_alias(&ht, argv[i] + strlen("--alias=")); * else * break; * } @@ -86,7 +88,7 @@ * // Find the other args in the hash table. * for (val = 0; i < argc; i++) { * struct name_to_digit *n; - * n = htable_get(ht, hash_string(argv[i]), + * n = htable_get(&ht, hash_string(argv[i]), * streq, argv[i]); * if (!n) * errx(1, "Invalid digit name %s", argv[i]); @@ -98,7 +100,7 @@ * return 0; * } * - * License: GPL (v2 or any later version) + * License: LGPL (v2.1 or any later version) * Author: Rusty Russell */ int main(int argc, char *argv[])