summaryrefslogtreecommitdiff
path: root/source3/lib/talloc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-06-03 03:07:24 +0000
committerAndrew Tridgell <tridge@samba.org>2002-06-03 03:07:24 +0000
commit0bb6053946a1572a3496958e543d5c9ddf74120b (patch)
treeb176a0e6a348c2d58d7ba52405a484d1384a6bb9 /source3/lib/talloc.c
parent9401cdbb514a65b96910117a5a850af0eef45dd7 (diff)
downloadsamba-0bb6053946a1572a3496958e543d5c9ddf74120b.tar.gz
samba-0bb6053946a1572a3496958e543d5c9ddf74120b.tar.bz2
samba-0bb6053946a1572a3496958e543d5c9ddf74120b.zip
put the ifdef for HAVE_VA_COPY in one place rather than in lots of
functions (This used to be commit 1cf3228fdc20f0314d1f8e71ad710a5e548b3f72)
Diffstat (limited to 'source3/lib/talloc.c')
-rw-r--r--source3/lib/talloc.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c
index b66d674dd5..d81528588c 100644
--- a/source3/lib/talloc.c
+++ b/source3/lib/talloc.c
@@ -318,18 +318,13 @@ smb_ucs2_t *talloc_strdup_w(TALLOC_CTX *t, const smb_ucs2_t *p)
char *ret;
va_list ap2;
-#ifdef HAVE_VA_COPY
- __va_copy(ap2, ap); /* for systems were va_list is a struct */
-#else
- ap2 = ap;
-#endif
+ VA_COPY(ap2, ap);
+
len = vsnprintf(NULL, 0, fmt, ap2);
ret = talloc(t, len+1);
if (ret) {
-#ifdef HAVE_VA_COPY
- __va_copy(ap2, ap);
-#endif
+ VA_COPY(ap2, ap);
vsnprintf(ret, len+1, fmt, ap2);
}
@@ -366,20 +361,16 @@ smb_ucs2_t *talloc_strdup_w(TALLOC_CTX *t, const smb_ucs2_t *p)
int len, s_len;
va_list ap2;
-#ifdef HAVE_VA_COPY
- __va_copy(ap2, ap);
-#else
- ap2 = ap;
-#endif
+ VA_COPY(ap2, ap);
+
s_len = strlen(s);
len = vsnprintf(NULL, 0, fmt, ap2);
s = talloc_realloc(t, s, s_len + len+1);
if (!s) return NULL;
-#ifdef HAVE_VA_COPY
- __va_copy(ap2, ap);
-#endif
+ VA_COPY(ap2, ap);
+
vsnprintf(s+s_len, len+1, fmt, ap2);
return s;