awk: another smallish code shrink
This commit is contained in:
parent
f8e8783a92
commit
8ae5b28b4b
@ -2028,9 +2028,7 @@ static var *exec_builtin(node *op, var *res)
|
|||||||
if (i < 0) i = 0;
|
if (i < 0) i = 0;
|
||||||
n = (nargs > 2) ? getvar_i(av[2]) : l-i;
|
n = (nargs > 2) ? getvar_i(av[2]) : l-i;
|
||||||
if (n < 0) n = 0;
|
if (n < 0) n = 0;
|
||||||
s = xzalloc(n + 1);
|
s = xstrndup(as[0]+i, n);
|
||||||
strncpy(s, as[0]+i, n);
|
|
||||||
/*s[n] = '\0'; - xzalloc did it */
|
|
||||||
setvar_p(res, s);
|
setvar_p(res, s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user