]> git.ozlabs.org Git - ccan/blobdiff - ccan/opt/helpers.c
io: handle duplex corner cases.
[ccan] / ccan / opt / helpers.c
index 17d56e0201dc66d7810b26f1cd40a1e5e702f0a7..25929bd5bf705f6681a1c7303288a58a16d4453c 100644 (file)
@@ -1,5 +1,6 @@
 /* Licensed under GPLv3+ - see LICENSE file for details */
 #include <ccan/opt/opt.h>
+#include <ccan/cast/cast.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -52,7 +53,7 @@ char *opt_set_invbool_arg(const char *arg, bool *b)
 /* Set a char *. */
 char *opt_set_charp(const char *arg, char **p)
 {
-       *p = (char *)arg;
+       *p = cast_const(char *, arg);
        return NULL;
 }
 
@@ -133,7 +134,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);
 }