Moving the malloc out of loop will make leak to disappear, and
the command might run few jiffie quicker when there are 1+N
arguments.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
argc -= optind;
argv += optind;
+ buf = xmalloc(bufsiz * sizeof(wchar_t));
+
do {
if (*argv) {
if ((fp = fopen(*argv, "r")) == NULL) {
filename = *argv++;
}
- buf = xmalloc(bufsiz * sizeof(wchar_t));
-
while (fgetws(buf, bufsiz, fp)) {
len = wcslen(buf);