diff options
-rw-r--r-- | libglusterfs/src/strfd.c | 19 | ||||
-rw-r--r-- | libglusterfs/src/strfd.h | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/libglusterfs/src/strfd.c b/libglusterfs/src/strfd.c index 8c97670d4dd..f5b7b94bfa1 100644 --- a/libglusterfs/src/strfd.c +++ b/libglusterfs/src/strfd.c @@ -33,14 +33,11 @@ strfd_open () int -strprintf (strfd_t *strfd, const char *fmt, ...) +strvprintf (strfd_t *strfd, const char *fmt, va_list ap) { - va_list ap; char *str = NULL; int size = 0; - va_start (ap, fmt); - size = vasprintf (&str, fmt, ap); if (size < 0) @@ -81,6 +78,20 @@ strprintf (strfd_t *strfd, const char *fmt, ...) int +strprintf (strfd_t *strfd, const char *fmt, ...) +{ + int ret = 0; + va_list ap; + + va_start (ap, fmt); + ret = strvprintf (strfd, fmt, ap); + va_end (ap); + + return ret; +} + + +int strfd_close (strfd_t *strfd) { GF_FREE (strfd->data); diff --git a/libglusterfs/src/strfd.h b/libglusterfs/src/strfd.h index e386c8432e4..a9e6eaa87bc 100644 --- a/libglusterfs/src/strfd.h +++ b/libglusterfs/src/strfd.h @@ -23,6 +23,8 @@ strfd_t *strfd_open(); int strprintf(strfd_t *strfd, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +int strvprintf(strfd_t *strfd, const char *fmt, va_list ap); + int strfd_close(strfd_t *strfd); #endif |