X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fidtree%2F_info;fp=ccan%2Fidtree%2F_info;h=058b32b48a2d49033b745c268a5ee0cf52036be5;hb=184070eb4a4a2e130c0053eb82fd8c96a19e954f;hp=0000000000000000000000000000000000000000;hpb=9f8c65b28acba8e5eabea5d7abd98b19e62d06fe;p=ccan diff --git a/ccan/idtree/_info b/ccan/idtree/_info new file mode 100644 index 00000000..058b32b4 --- /dev/null +++ b/ccan/idtree/_info @@ -0,0 +1,53 @@ +#include +#include +#include "config.h" + +/** + * idtree - id allocation tree + * + * There are often cases where you want to provide an integer handle for + * some data, and easily map it back to another structure. + * + * idtree is an efficient implementation of an int->void * mapping, with + * assignment of the lowest available id number. It is from the Linux kernel + * via the Samba project. + * + * Example: + * #include + * #include + * #include + * #include + * + * // Silly example which puts args in the idtree and retreives them + * int main(int argc, char *argv[]) + * { + * struct idtree *idtree = idtree_new(NULL); + * unsigned int i; + * + * // This will return consecutive id numbers. + * for (i = 0; i < argc; i++) { + * printf("idtree_add('%s') -> id %i\n", + * argv[i], idtree_add(idtree, argv[i], -1)); + * } + * for (i = 0; i < argc; i++) { + * printf("id %i -> '%s'\n", i, idtree_lookup(idtree, i)); + * } + * return 0; + * } + * + * Licence: GPL (2 or any later version) + * Maintainer: Rusty Russell + * Author: Jim Houston + */ +int main(int argc, char *argv[]) +{ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/talloc\n"); + return 0; + } + + return 1; +}