svn commit: samba r5938 - in branches/SAMBA_4_0/source/lib/talloc: .
tridge at samba.org
tridge at samba.org
Tue Mar 22 05:51:42 GMT 2005
Author: tridge
Date: 2005-03-22 05:51:41 +0000 (Tue, 22 Mar 2005)
New Revision: 5938
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5938
Log:
- allow NULL string argument to talloc_vasprintf_append()
- default to using va_copy(), thus assuming a modern libc
Modified:
branches/SAMBA_4_0/source/lib/talloc/talloc.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.c 2005-03-22 04:22:39 UTC (rev 5937)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.c 2005-03-22 05:51:41 UTC (rev 5938)
@@ -36,6 +36,8 @@
#include <stdarg.h>
#include <stdint.h>
#include "talloc.h"
+/* assume a modern system */
+#define HAVE_VA_COPY
#endif
/* use this to force every realloc to change the pointer, to stress test
@@ -946,10 +948,16 @@
static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(s);
+ struct talloc_chunk *tc;
int len, s_len;
va_list ap2;
+ if (s == NULL) {
+ return talloc_vasprintf(NULL, fmt, ap);
+ }
+
+ tc = talloc_chunk_from_ptr(s);
+
VA_COPY(ap2, ap);
s_len = tc->size - 1;
More information about the samba-cvs
mailing list