mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
charcnv: add talloc_strdup_lower() - talloc variant of strdup_lower().
Michael
(This used to be commit 5f6c730cbe
)
This commit is contained in:
parent
2ca280d551
commit
1fcbcbb486
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user