summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-09 17:32:26 -0800
committerJeremy Allison <jra@samba.org>2008-01-09 17:32:26 -0800
commit980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8 (patch)
tree1346ffda48fd6f92daeac194eb84bba3e631a983 /source3/lib/charcnv.c
parent253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b (diff)
downloadsamba-980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8.tar.gz
samba-980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8.tar.bz2
samba-980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8.zip
Fixup hot paths - add macro for toupper (c < 0x80).
This now matches 3.0.x on my micro-tests. Jeremy. (This used to be commit 329b924cba8225002ca40db26c45b31d141a0925)
Diffstat (limited to 'source3/lib/charcnv.c')
-rw-r--r--source3/lib/charcnv.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 8a00b235cc..eeff805459 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -614,10 +614,16 @@ size_t convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to,
out:
destlen = destlen - o_len;
- if (ctx) {
- ob = (char *)TALLOC_REALLOC(ctx,ob,destlen);
- } else {
- ob = (char *)SMB_REALLOC(ob,destlen);
+ /* Don't shrink unless we're reclaiming a lot of
+ * space. This is in the hot codepath and these
+ * reallocs *cost*. JRA.
+ */
+ if (o_len > 1024) {
+ if (ctx) {
+ ob = (char *)TALLOC_REALLOC(ctx,ob,destlen);
+ } else {
+ ob = (char *)SMB_REALLOC(ob,destlen);
+ }
}
if (destlen && !ob) {
@@ -778,7 +784,7 @@ char *strdup_upper(const char *s)
while (*p) {
if (*p & 0x80)
break;
- *q++ = toupper_ascii(*p);
+ *q++ = toupper_ascii_fast(*p);
p++;
}
@@ -844,7 +850,7 @@ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s)
while (*p) {
if (*p & 0x80)
break;
- *q++ = toupper_ascii(*p);
+ *q++ = toupper_ascii_fast(*p);
p++;
}