summaryrefslogtreecommitdiff
path: root/source4/lib/talloc/talloc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-03-22 04:22:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:10 -0500
commit340d35be2d3f29a3176d86c0960398c2e36f921f (patch)
tree7d6eae8267c01b177a5c487348c3f764fad8c0e5 /source4/lib/talloc/talloc.c
parent455be8fb8271bd97058390dca5a76db81ea2928b (diff)
downloadsamba-340d35be2d3f29a3176d86c0960398c2e36f921f.tar.gz
samba-340d35be2d3f29a3176d86c0960398c2e36f921f.tar.bz2
samba-340d35be2d3f29a3176d86c0960398c2e36f921f.zip
r5937: - performance improvement to talloc_asprintf_append()
- allow standalone talloc to use gcc printf attributes (This used to be commit e25aa54e962796e6e7385afed57aa287ef6f869d)
Diffstat (limited to 'source4/lib/talloc/talloc.c')
-rw-r--r--source4/lib/talloc/talloc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index 291ee5a8bf..72765448c7 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -946,16 +946,13 @@ static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINT
static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(s);
int len, s_len;
va_list ap2;
VA_COPY(ap2, ap);
- if (s) {
- s_len = strlen(s);
- } else {
- s_len = 0;
- }
+ s_len = tc->size - 1;
len = vsnprintf(NULL, 0, fmt, ap2);
s = talloc_realloc(NULL, s, char, s_len + len+1);