diff options
author | Jeremy Allison <jra@samba.org> | 2003-09-04 01:12:39 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-09-04 01:12:39 +0000 |
commit | 245fbf7efbc42530c81d5aac66681bb892c97557 (patch) | |
tree | 6e4a7e8bd5e5d66336e7f3689a62812322053103 /source3/lib/util_str.c | |
parent | 7da5c6a0e719470e234ad6597ba33c9667786ab2 (diff) | |
download | samba-245fbf7efbc42530c81d5aac66681bb892c97557.tar.gz samba-245fbf7efbc42530c81d5aac66681bb892c97557.tar.xz samba-245fbf7efbc42530c81d5aac66681bb892c97557.zip |
Used cachegrind to track down some bottlenecks.
Removed calls to clobber_region when not compiling with developer as
they were hiding speed problems.
Added fast path to convert_string() when dealing with ascii -> ascii,
ucs2-le to ascii and ascii to ucs2-le with values <= 0x7F. This
gives a speedup of 22% on my nbench tests.
Next I will do this on convert_string_allocate.
Jeremy.
(This used to be commit ef140d15ea0d76a3e7cdcadbfd3e917c210a9411)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r-- | source3/lib/util_str.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index f036d88da08..e1db93a1318 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -503,7 +503,9 @@ char *safe_strcpy_fn(const char *fn, int line, char *dest,const char *src, size_ return NULL; } +#ifdef DEVELOPER clobber_region(fn,line,dest, maxlength+1); +#endif if (!src) { *dest = 0; @@ -542,7 +544,9 @@ char *safe_strcat_fn(const char *fn, int line, char *dest, const char *src, size src_len = strnlen(src, maxlength + 1); dest_len = strnlen(dest, maxlength + 1); +#ifdef DEVELOPER clobber_region(fn, line, dest + dest_len, maxlength + 1 - dest_len); +#endif if (src_len + dest_len > maxlength) { DEBUG(0,("ERROR: string overflow by %d in safe_strcat [%.50s]\n", @@ -569,7 +573,9 @@ char *alpha_strcpy_fn(const char *fn, int line, char *dest, const char *src, con { size_t len, i; +#ifdef DEVELOPER clobber_region(fn, line, dest, maxlength); +#endif if (!dest) { DEBUG(0,("ERROR: NULL dest in alpha_strcpy\n")); @@ -609,7 +615,9 @@ char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n) { char *d = dest; +#ifdef DEVELOPER clobber_region(fn, line, dest, n+1); +#endif if (!dest) return(NULL); @@ -639,8 +647,9 @@ static char *strncpyn(char *dest, const char *src, size_t n, char c) char *p; size_t str_len; +#ifdef DEVELOPER clobber_region(dest, n+1); - +#endif p = strchr_m(src, c); if (p == NULL) { DEBUG(5, ("strncpyn: separator character (%c) not found\n", c)); |