X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftal%2Fautoptr%2F_info;fp=ccan%2Ftal%2Fautoptr%2F_info;h=b233ce58507c8dc33859cc7123a5873da54c85b2;hb=97ac5832db26f5f836fff979b08f01e17d7216bd;hp=0000000000000000000000000000000000000000;hpb=58277ab6c8b4dd6bb66638b88bd8505f46fdcb07;p=ccan diff --git a/ccan/tal/autoptr/_info b/ccan/tal/autoptr/_info new file mode 100644 index 00000000..b233ce58 --- /dev/null +++ b/ccan/tal/autoptr/_info @@ -0,0 +1,44 @@ +#include "config.h" +#include +#include + +/** + * tal/autoptr - automatic updates of pointers to tal objects. + * + * This code updates pointers when the pointed-to object is freed. + * + * Maintainer: Rusty Russell + * License: BSD-MIT + * Example: + * #include + * #include + * + * static void *p; + * + * int main(void) + * { + * char *c = tal(NULL, char); + * + * // Sets p to point to c. + * autonull_set_ptr(NULL, &p, c); + * assert(p == c); + * + * // Automatically clears p. + * tal_free(c); + * assert(p == NULL); + * return 0; + * } + */ +int main(int argc, char *argv[]) +{ + /* Expect exactly one argument */ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/tal\n"); + return 0; + } + + return 1; +}