From 2bcc6d7f6696fcb6799ea64389b944d61fa0c3e4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 19 Dec 2016 09:52:30 +0100 Subject: [PATCH] tweaks: start searching at a better place Taking the terminating newline into account, and that there is at least one digit per number. --- src/files.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/files.c b/src/files.c index 5e00dd3f..9ecad057 100644 --- a/src/files.c +++ b/src/files.c @@ -3186,13 +3186,13 @@ void load_poshistory(void) poshiststruct *record_ptr = NULL, *newrecord; /* Read and parse each line, and store the extracted data. */ - while ((read = getline(&line, &buf_len, hist)) > 2) { - /* Decode nulls as newlines. */ + while ((read = getline(&line, &buf_len, hist)) > 5) { + /* Decode nulls as embedded newlines. */ unsunder(line, read); - /* Find where x index and line number are in the line. */ - xptr = revstrstr(line, " ", line + read); - lineptr = revstrstr(line, " ", xptr - 1); + /* Find where the x index and line number are in the line. */ + xptr = revstrstr(line, " ", line + read - 3); + lineptr = revstrstr(line, " ", xptr - 2); /* Now separate the three elements of the line. */ *(xptr++) = '\0';