From b918e9157db5f68558bd9972722d6e6359170487 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 9 Nov 2012 22:34:14 +0000 Subject: [PATCH] getdata: stop looking after interesting field The nth_field function continued looking for words after they where known not to be interesting. Signed-off-by: Sami Kerola --- src/getdata.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/getdata.c b/src/getdata.c index 0a11559..beeff89 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -188,6 +188,8 @@ int nth_field(int n, char *restrict dest, const char *restrict src) } else { if (j == 0) { wordn++; + if (n + 1 < wordn) + break; } if (wordn == n) { dest[j] = src[i];