Optimize r_str_replace with r_str_replace_char in some cases
This commit is contained in:
parent
e445f6cef0
commit
ce4a15decb
1 changed files with 4 additions and 0 deletions
|
|
@ -993,6 +993,10 @@ R_API char* r_str_replace(char *str, const char *key, const char *val, int g) {
|
|||
}
|
||||
klen = strlen (key);
|
||||
vlen = strlen (val);
|
||||
if (klen == 1 && vlen < 2) {
|
||||
r_str_replace_char (str, *key, *val);
|
||||
return str;
|
||||
}
|
||||
if (klen == vlen && !strcmp (key, val)) {
|
||||
return str;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue