From 8ae5b28b4bff5f1099a4a77af89e1a7e23ad77e2 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 2 Jul 2008 22:47:49 +0000 Subject: [PATCH] awk: another smallish code shrink --- editors/awk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/editors/awk.c b/editors/awk.c index 44b747b29..aac40aa93 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -2028,9 +2028,7 @@ static var *exec_builtin(node *op, var *res) if (i < 0) i = 0; n = (nargs > 2) ? getvar_i(av[2]) : l-i; if (n < 0) n = 0; - s = xzalloc(n + 1); - strncpy(s, as[0]+i, n); - /*s[n] = '\0'; - xzalloc did it */ + s = xstrndup(as[0]+i, n); setvar_p(res, s); break; -- 2.25.1