mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
lib: Move get_iconv_handle() call down
We only need this in the slow path. A good compiler might detect this, but as get_iconv_handle() might have side-effects from a compiler's point of view, I'm not sure it's legal to skip the call in the fast path. Might be premature optimization, but it's low hanging fruit :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed by: Ira Cooper <ira@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Mar 23 21:21:15 CET 2015 on sn-devel-104
This commit is contained in:
parent
8de2164835
commit
dee2b958c0
@ -369,7 +369,7 @@ _PUBLIC_ char *strchr_m(const char *src, char c)
|
|||||||
*/
|
*/
|
||||||
_PUBLIC_ char *strrchr_m(const char *s, char c)
|
_PUBLIC_ char *strrchr_m(const char *s, char c)
|
||||||
{
|
{
|
||||||
struct smb_iconv_handle *ic = get_iconv_handle();
|
struct smb_iconv_handle *ic;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
@ -416,6 +416,8 @@ _PUBLIC_ char *strrchr_m(const char *s, char c)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ic = get_iconv_handle();
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
size_t size;
|
size_t size;
|
||||||
codepoint_t c2 = next_codepoint_handle(ic, s, &size);
|
codepoint_t c2 = next_codepoint_handle(ic, s, &size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user