From 45943bfd933a285695b7964d29dfefb36a4fef42 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Fri, 14 Mar 2008 22:00:09 +0000 Subject: [PATCH] Add a useful sprintf()-style wrapper around archive_string_vsprintf(). (Which is built on top of libarchive's internal resizable string support.) --- lib/libarchive/archive_string.h | 3 +++ lib/libarchive/archive_string_sprintf.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/libarchive/archive_string.h b/lib/libarchive/archive_string.h index b9b5352cd644..271eae3379c1 100644 --- a/lib/libarchive/archive_string.h +++ b/lib/libarchive/archive_string.h @@ -116,4 +116,7 @@ void __archive_string_vsprintf(struct archive_string *, const char *, va_list); #define archive_string_vsprintf __archive_string_vsprintf +void __archive_string_sprintf(struct archive_string *, const char *, ...); +#define archive_string_sprintf __archive_string_sprintf + #endif diff --git a/lib/libarchive/archive_string_sprintf.c b/lib/libarchive/archive_string_sprintf.c index 4401e9a12773..44b116eac0af 100644 --- a/lib/libarchive/archive_string_sprintf.c +++ b/lib/libarchive/archive_string_sprintf.c @@ -44,6 +44,16 @@ __FBSDID("$FreeBSD$"); #include "archive_string.h" #include "archive_private.h" +void +__archive_string_sprintf(struct archive_string *as, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + archive_string_vsprintf(as, fmt, ap); + va_end(ap); +} + /* * Like 'vsprintf', but ensures the target is big enough, resizing if * necessary.