Add a useful sprintf()-style wrapper around

archive_string_vsprintf().  (Which is built
on top of libarchive's internal resizable string
support.)
This commit is contained in:
Tim Kientzle 2008-03-14 22:00:09 +00:00
parent 4109ba516e
commit 45943bfd93
2 changed files with 13 additions and 0 deletions

View File

@ -116,4 +116,7 @@ void __archive_string_vsprintf(struct archive_string *, const char *,
va_list); va_list);
#define archive_string_vsprintf __archive_string_vsprintf #define archive_string_vsprintf __archive_string_vsprintf
void __archive_string_sprintf(struct archive_string *, const char *, ...);
#define archive_string_sprintf __archive_string_sprintf
#endif #endif

View File

@ -44,6 +44,16 @@ __FBSDID("$FreeBSD$");
#include "archive_string.h" #include "archive_string.h"
#include "archive_private.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 * Like 'vsprintf', but ensures the target is big enough, resizing if
* necessary. * necessary.