X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fopt%2Fhelpers.c;h=48f4fa45991ed1809438f55ae4f840485b0d3946;hb=76565e3d88495f0239ab59ee1ca5f0b515897832;hp=e7ab273cdcede67a9bec9ae868ec8d8faa84cd6b;hpb=fba46ae074025cb605d46be9b1080e0649635dd6;p=ccan diff --git a/ccan/opt/helpers.c b/ccan/opt/helpers.c index e7ab273c..48f4fa45 100644 --- a/ccan/opt/helpers.c +++ b/ccan/opt/helpers.c @@ -1,7 +1,9 @@ /* Licensed under GPLv3+ - see LICENSE file for details */ #include #include +#include #include +#include #include #include #include @@ -134,7 +136,7 @@ char *opt_usage_and_exit(const char *extra) char *usage = opt_usage(opt_argv0, extra); printf("%s", usage); /* Don't have valgrind complain! */ - free(usage); + opt_alloc.free(usage); opt_free_table(); exit(0); } @@ -401,9 +403,9 @@ static void show_llong_with_suffix(char buf[OPT_SHOW_LEN], long long ll, ll = tmp; } if (i == 0) - snprintf(buf, OPT_SHOW_LEN, "%lld", ll); + snprintf(buf, OPT_SHOW_LEN, "%"PRId64, (int64_t)ll); else - snprintf(buf, OPT_SHOW_LEN, "%lld%c", ll, suffixes[i - 1]); + snprintf(buf, OPT_SHOW_LEN, "%"PRId64"%c", (int64_t)ll, suffixes[i - 1]); } static void show_ullong_with_suffix(char buf[OPT_SHOW_LEN], unsigned long long ull, @@ -423,9 +425,9 @@ static void show_ullong_with_suffix(char buf[OPT_SHOW_LEN], unsigned long long u ull = tmp; } if (i == 0) - snprintf(buf, OPT_SHOW_LEN, "%llu", ull); + snprintf(buf, OPT_SHOW_LEN, "%"PRIu64, (uint64_t)ull); else - snprintf(buf, OPT_SHOW_LEN, "%llu%c", ull, suffixes[i - 1]); + snprintf(buf, OPT_SHOW_LEN, "%"PRIu64"%c", (uint64_t)ull, suffixes[i - 1]); } /* _bi, signed */