diff options
author | Simo Sorce <idra@samba.org> | 2005-06-26 23:59:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:52 -0500 |
commit | 1702f52498168c0437416dec1014cedead634774 (patch) | |
tree | 51085d868dd9e562571ccb96dac48a5dd43bd55a /source4/lib/talloc | |
parent | 14b0722edf38872ba258c27e27094536ecb93d4f (diff) | |
download | samba-1702f52498168c0437416dec1014cedead634774.tar.gz samba-1702f52498168c0437416dec1014cedead634774.tar.bz2 samba-1702f52498168c0437416dec1014cedead634774.zip |
r7936: new ldb_dn_explode and ldb_dn_casefold functions and co
(This used to be commit 7ccf21ab4eeb9821e457308a239f2103a106fb12)
Diffstat (limited to 'source4/lib/talloc')
-rw-r--r-- | source4/lib/talloc/talloc.c | 22 | ||||
-rw-r--r-- | source4/lib/talloc/talloc.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 08d4cb93a6..3adf741870 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -918,6 +918,28 @@ char *talloc_strdup(const void *t, const char *p) } /* + append to a talloced string +*/ +char *talloc_append_string(const void *t, char *orig, const char *append) +{ + char *ret; + size_t olen = strlen(orig); + size_t alenz = strlen(append) + 1; + + if (!append) + return orig; + + ret = talloc_realloc(t, orig, char, olen + alenz); + if (!ret) + return NULL; + + /* append the string with the trailing \0 */ + memcpy(&ret[olen], append, alenz); + + return ret; +} + +/* strndup with a talloc */ char *talloc_strndup(const void *t, const char *p, size_t n) diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h index 04d5cbb9af..d68510abef 100644 --- a/source4/lib/talloc/talloc.h +++ b/source4/lib/talloc/talloc.h @@ -119,6 +119,7 @@ void *_talloc_zero(const void *ctx, size_t size, const char *name); void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); char *talloc_strdup(const void *t, const char *p); char *talloc_strndup(const void *t, const char *p, size_t n); +char *talloc_append_string(const void *t, char *orig, const char *append); char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); char *talloc_asprintf_append(char *s, |