On Mon, Mar 05, 2012 at 08:38:52PM +0100, Sami Kerola wrote: > Signed-off-by: Sami Kerola <kerolasa@xxxxxx> > --- > include/xalloc.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) maybe add xasprintf to tools/checkxalloc.sh as well? > diff --git a/include/xalloc.h b/include/xalloc.h > index feeb114..8c22ff7 100644 > --- a/include/xalloc.h > +++ b/include/xalloc.h > @@ -63,4 +63,15 @@ static inline char *xstrdup(const char *str) > return ret; > } > > +static inline int xasprintf(char **strp, char *fmt, ...) > +{ > + int ret; > + va_list args; > + va_start(args, fmt); > + ret = vasprintf(&(*strp), fmt, args); > + va_end(args); > + if (ret < 0) > + err(XALLOC_EXIT_CODE, "cannot allocate string"); > + return ret; > +} > #endif > -- > 1.7.9.2 > > -- > To unsubscribe from this list: send the line "unsubscribe util-linux" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html