From: Rusty Russell Date: Mon, 18 Aug 2014 17:03:03 +0000 (+0930) Subject: charset: make example use tal/grab_file instead of grab_file. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=cbb99113cd42e631934221dcf27093906e19a463 charset: make example use tal/grab_file instead of grab_file. Signed-off-by: Rusty Russell --- diff --git a/ccan/charset/_info b/ccan/charset/_info index aa0193d7..919acda6 100644 --- a/ccan/charset/_info +++ b/ccan/charset/_info @@ -14,8 +14,8 @@ * #include * #include * #include - * #include - * #include + * #include + * #include * * static void print_json_string(const char *s); * static bool parse_hex16(const char **sp, unsigned int *out); @@ -24,23 +24,22 @@ * 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; * } *