ash: speed up ${v//pattern/repl}
function old new delta subevalvar 1447 1457 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@ -7292,17 +7292,20 @@ subevalvar(char *start, char *str, int strloc,
|
|||||||
* x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;echo ${#x}
|
* x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;x=$x$x;echo ${#x}
|
||||||
* echo "${x//:/|}"
|
* echo "${x//:/|}"
|
||||||
*/
|
*/
|
||||||
size_t n;
|
|
||||||
if (strncmp(rmesc, str, no_meta_len) != 0)
|
if (strncmp(rmesc, str, no_meta_len) != 0)
|
||||||
goto no_match;
|
goto no_match;
|
||||||
n = no_meta_len;
|
|
||||||
loc = idx;
|
loc = idx;
|
||||||
|
if (!quotes) {
|
||||||
|
loc += no_meta_len;
|
||||||
|
} else {
|
||||||
|
size_t n = no_meta_len;
|
||||||
do {
|
do {
|
||||||
if (quotes && (unsigned char)*loc == CTLESC)
|
if ((unsigned char)*loc == CTLESC)
|
||||||
loc++;
|
loc++;
|
||||||
loc++;
|
loc++;
|
||||||
} while (--n != 0);
|
} while (--n != 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//bb_error_msg("scanright('%s'):'%s'", str, loc);
|
//bb_error_msg("scanright('%s'):'%s'", str, loc);
|
||||||
if (!loc) {
|
if (!loc) {
|
||||||
char *restart_detect;
|
char *restart_detect;
|
||||||
|
Reference in New Issue
Block a user