diff options
author | okan <okan> | 2012-11-28 14:32:44 +0000 |
---|---|---|
committer | okan <okan> | 2012-11-28 14:32:44 +0000 |
commit | 878eb6bf050c6b55104e12c17b9644c2625bace0 (patch) | |
tree | be1e94e67f405cf90402675cf56cba3ec8a3b250 /xmalloc.c | |
parent | b4315a3fdad8dc66e649a4df89617160943ae144 (diff) | |
parent | 3e151f8c764a5f1116fae3bea87f3d4474dc686a (diff) | |
download | cwm-878eb6bf050c6b55104e12c17b9644c2625bace0.tar.gz cwm-878eb6bf050c6b55104e12c17b9644c2625bace0.tar.xz cwm-878eb6bf050c6b55104e12c17b9644c2625bace0.zip |
cvsimport
Diffstat (limited to 'xmalloc.c')
-rw-r--r-- | xmalloc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/xmalloc.c b/xmalloc.c index a93393f..3248124 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -69,3 +69,19 @@ xstrdup(const char *str) return (p); } + +int +xasprintf(char **ret, const char *fmt, ...) +{ + va_list ap; + int i; + + va_start(ap, fmt); + i = vasprintf(ret, fmt, ap); + va_end(ap); + + if (i < 0 || *ret == NULL) + err(1, "asprintf"); + + return (i); +} |