summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-09-05 19:59:55 +0000
committerJeremy Allison <jra@samba.org>2003-09-05 19:59:55 +0000
commit94f59f54921174fc156fade575ca114d331b1bd8 (patch)
tree06c2548e853c68c2bb24cce2ce3ba75eb3c8497e /source3/lib/charcnv.c
parent7544b0c77382e300da0e2daf2b325527a23e6ddc (diff)
downloadsamba-94f59f54921174fc156fade575ca114d331b1bd8.tar.gz
samba-94f59f54921174fc156fade575ca114d331b1bd8.tar.bz2
samba-94f59f54921174fc156fade575ca114d331b1bd8.zip
More tuning from cachegrind. Change most trim_string() calls to trim_char(0,
as that's what they do. Fix string_replace() to fast-path ascii. Jeremy. (This used to be commit f35e9a8b909d3c74be47083ccc4a4e91a14938db)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index a07ff7399d..ceb9d57fc7 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -879,9 +879,8 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
}
if (flags & STR_TERMINATE) {
- if (src_len == (size_t)-1) {
- src_len = strlen_w(src)*2 + 2;
- } else {
+ /* src_len -1 is the default for null terminated strings. */
+ if (src_len != (size_t)-1) {
size_t len = strnlen_w(src, src_len/2);
if (len < src_len/2)
len++;
@@ -1051,4 +1050,3 @@ size_t align_string(const void *base_ptr, const char *p, int flags)
}
return 0;
}
-