summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-08-31 08:38:34 +0100
committerPádraig Brady <P@draigBrady.com>2010-09-01 16:12:45 +0100
commit126d59542f89774a4c331a6a52b4c5dce4fce25e (patch)
tree7b7907103b1b1c14737c9bc2c33b95f44e21f148 /src
parent777024889c0043004962834f4d9353cfa6847dd6 (diff)
downloadcoreutils-126d59542f89774a4c331a6a52b4c5dce4fce25e.tar.xz
join: improve performance when operating on whole lines
Following on from commit f86bb696, 01-02-2010, "join: make -t '' operate on the whole line". Bypassing the delimiter search in this case, gives about an 8% performance boost. * src/join (xfields): Don't bother looking for '\n' in the data, which we know won't be present.
Diffstat (limited to 'src')
-rw-r--r--src/join.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/join.c b/src/join.c
index fa18c9d06..6eaad6575 100644
--- a/src/join.c
+++ b/src/join.c
@@ -249,13 +249,13 @@ xfields (struct line *line)
if (ptr == lim)
return;
- if (0 <= tab)
+ if (0 <= tab && tab != '\n')
{
char *sep;
for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1)
extract_field (line, ptr, sep - ptr);
}
- else
+ else if (tab < 0)
{
/* Skip leading blanks before the first field. */
while (isblank (to_uchar (*ptr)))