summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/strfd.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2014-03-29 04:54:16 -0700
committerAnand Avati <avati@redhat.com>2014-04-29 14:51:30 -0700
commit540065ba490339ce173552751953485fa32ed0bf (patch)
treef733594ef5877072a72517b55e87d2e81005adfa /libglusterfs/src/strfd.c
parentc61bc1f9e5874cb8380ec6398680fc71aea233b4 (diff)
strfd: introduce strvprintf() API
variant of strprintf() which accepts va_list as parameter instead of variable args (...) Change-Id: I205acf3aaf5440890d5f9cad693c6a358a5d9218 BUG: 1089216 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/7539 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs/src/strfd.c')
-rw-r--r--libglusterfs/src/strfd.c19
1 files changed, 15 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);