summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-09 15:36:55 +0200
committerMichael Adam <obnox@samba.org>2008-04-10 01:27:56 +0200
commit1fcbcbb486e7c599b11872f003ae213610ea09e4 (patch)
treee07809101648a0f0f9cad6ed44386e90ba4ff461 /source3/lib
parent2ca280d551e5e99ccfd8d68449b0b6e1117c2be1 (diff)
downloadsamba-1fcbcbb486e7c599b11872f003ae213610ea09e4.tar.gz
samba-1fcbcbb486e7c599b11872f003ae213610ea09e4.tar.bz2
samba-1fcbcbb486e7c599b11872f003ae213610ea09e4.zip
charcnv: add talloc_strdup_lower() - talloc variant of strdup_lower().
Michael (This used to be commit 5f6c730cbeddd1ac2f515bd985c08ceb4ca9bc47)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charcnv.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index d11620ecd7..69d1db0e48 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -945,6 +945,32 @@ char *strdup_lower(const char *s)
return out_buffer;
}
+char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s)
+{
+ size_t size;
+ smb_ucs2_t *buffer = NULL;
+ char *out_buffer;
+
+ size = push_ucs2_talloc(ctx, &buffer, s);
+ if (size == -1 || !buffer) {
+ TALLOC_FREE(buffer);
+ return NULL;
+ }
+
+ strlower_w(buffer);
+
+ size = pull_ucs2_talloc(ctx, &out_buffer, buffer);
+ TALLOC_FREE(buffer);
+
+ if (size == (size_t)-1) {
+ TALLOC_FREE(out_buffer);
+ return NULL;
+ }
+
+ return out_buffer;
+}
+
+
size_t ucs2_align(const void *base_ptr, const void *p, int flags)
{
if (flags & (STR_NOALIGN|STR_ASCII))