The new line detection is earlier using only '\n' so there should not be
need to search for '\r' later.
The detection whether allocated address is pointing to null seems to be
unnecessary. Assuming xmalloc() returned valid address space the address
should never be 0.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
len = wcslen(buf);
}
- t = buf + len - 1 - (*(buf+len-1)=='\r' || *(buf+len-1)=='\n');
- for ( ; t >= buf; --t) {
- if (*t != 0)
- putwchar(*t);
- }
+ if (*(t = buf + len - 1) == '\n')
+ --t;
+ for ( ; buf <= t; --t)
+ putwchar(*t);
if (!feof(fp))
putwchar('\n');
}