diff options
author | Gerald Carter <jerry@samba.org> | 2005-03-23 23:26:33 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2005-03-23 23:26:33 +0000 |
commit | 93ab3fde9d8b069c0ecb90a5d9d40f8c54ebcdc1 (patch) | |
tree | 60aba482ed13e619ad07a431542aaa169ceefc7a /source/lib/talloc.c | |
parent | 372babcdc575fd726f645f9ce0bc0da836416592 (diff) | |
download | samba-93ab3fde9d8b069c0ecb90a5d9d40f8c54ebcdc1.tar.gz samba-93ab3fde9d8b069c0ecb90a5d9d40f8c54ebcdc1.tar.xz samba-93ab3fde9d8b069c0ecb90a5d9d40f8c54ebcdc1.zip |
r6014: rather large change set....
pulling back all recent rpc changes from trunk into
3.0. I've tested a compile and so don't think I've missed
any files. But if so, just mail me and I'll clean backup
in a couple of hours.
Changes include \winreg, \eventlog, \svcctl, and
general parse_misc.c updates.
I am planning on bracketing the event code with an
#ifdef ENABLE_EVENTLOG until I finish merging Marcin's
changes (very soon).
Diffstat (limited to 'source/lib/talloc.c')
-rw-r--r-- | source/lib/talloc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/lib/talloc.c b/source/lib/talloc.c index cafe0654790..f5e21299b5a 100644 --- a/source/lib/talloc.c +++ b/source/lib/talloc.c @@ -338,6 +338,19 @@ char *talloc_strdup(TALLOC_CTX *t, const char *p) return NULL; } +/* strndup with a talloc */ +char *talloc_strndup(TALLOC_CTX *mem_ctx, const char *str, size_t maxlen) +{ + size_t len = strnlen(str, maxlen); + void *ret = TALLOC(mem_ctx, len+1); + + if (ret != NULL) { + memcpy(ret, str, len); + ((char *)ret)[len] = '\0'; + } + return ret; +} + /** strdup_upper with a talloc */ char *talloc_strdup_upper(TALLOC_CTX *t, const char *p) { |