]> git.ozlabs.org Git - ccan/blobdiff - ccan/opt/helpers.c
opt: don't use raw malloc for errors.
[ccan] / ccan / opt / helpers.c
index f247301cd7a2ba236871f8327c56a79ea144509f..118e543602e06b981e6faee7dd5f416cf819d5cd 100644 (file)
 /* Upper bound to sprintf this simple type?  Each 3 bits < 1 digit. */
 #define CHAR_SIZE(type) (((sizeof(type)*CHAR_BIT + 2) / 3) + 1)
 
-/* FIXME: asprintf module? */
 static char *arg_bad(const char *fmt, const char *arg)
 {
-       char *str = malloc(strlen(fmt) + strlen(arg));
+       char *str = opt_alloc.alloc(strlen(fmt) + strlen(arg));
        sprintf(str, fmt, arg);
        return str;
 }