charset: make example use tal/grab_file instead of grab_file.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 18 Aug 2014 17:03:03 +0000 (02:33 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 18 Aug 2014 17:03:03 +0000 (02:33 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/charset/_info

index aa0193d7e4b83de5f1c37dba73969be65194b6a2..919acda618641b57dd73e4901bb3b7c9e1dab91b 100644 (file)
@@ -14,8 +14,8 @@
  *     #include <stdlib.h>
  *     #include <string.h>
  *     #include <ccan/charset/charset.h>
- *     #include <ccan/grab_file/grab_file.h>
- *     #include <ccan/talloc/talloc.h>
+ *     #include <ccan/tal/grab_file/grab_file.h>
+ *     #include <ccan/tal/tal.h>
  *     
  *     static void print_json_string(const char *s);
  *     static bool parse_hex16(const char **sp, unsigned int *out);
  *     int main(void)
  *     {
  *             char *input;
- *             size_t length;
  *     
- *             input = grab_file(NULL, NULL, &length);
+ *             input = grab_file(NULL, NULL);
  *             if (!input)
  *                     err(1, "Error reading input");
- *             if (!utf8_validate(input, length)) {
+ *             if (!utf8_validate(input, tal_count(input)-1)) {
  *                     fprintf(stderr, "Input contains invalid UTF-8\n");
  *                     return 1;
  *             }
- *             if (strlen(input) != length) {
+ *             if (strlen(input) != tal_count(input)-1) {
  *                     fprintf(stderr, "Input contains null characters\n");
  *                     return 1;
  *             }
  *             
  *             print_json_string(input);
  *             
- *             talloc_free(input);
+ *             tal_free(input);
  *             return 0;
  *     }
  *