]> git.ozlabs.org Git - ccan/blobdiff - ccan/take/_info
take, tal, tal/path, tal/str, tal/talloc: annotate APIs with TAKES.
[ccan] / ccan / take / _info
index 34b0886102c8e835cb0649a1fc378559f20db3de..c8cc4ac995789fc9f646b82b060a8c48b641ce02 100644 (file)
@@ -1,5 +1,6 @@
-#include <string.h>
 #include "config.h"
+#include <stdio.h>
+#include <string.h>
 
 /**
  * take - routines to mark pointers to be consumed by called functions.
  * License: CC0 (Public domain)
  *
  * Example:
- *     // Given foo/bar.c outputs basename is bar.c
+ *     // Given "foo/bar.c" outputs basename is bar.c
  *     #include <ccan/take/take.h>
  *     #include <string.h>
  *
  *     // Dumb basename program and driver.
- *     static char *base(const char *file)
+ *     static char *base(const char *file TAKES)
  *     {
  *             const char *p = strrchr(file, '/');
  *             if (!p) 
@@ -36,7 +37,7 @@
  *     {
  *             char *b;
  *
- *             if (argv[1]) // Mangle in place.
+ *             if (argc > 1) // Mangle in place.
  *                     b = base(take(argv[1]));
  *             else
  *                     b = base("test/string");
@@ -52,6 +53,7 @@ int main(int argc, char *argv[])
 
        if (strcmp(argv[1], "depends") == 0) {
                printf("ccan/likely\n");
+               printf("ccan/str\n");
                return 0;
        }