nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f8f2d631071bc7bcc3c694bbc54125c43ffed02b
parent 13ba5432cd105a6090b352f3a12c32d7067e9b1d
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun, 17 Jan 2016 17:04:28 +0000

Limiting the number of loaded items in the positions history.
(So that most likely not more than two hundred plus a handful
will be written out.  This was the easiest to implement.)

See https://lists.gnu.org/archive/html/nano-devel/2016-01/msg00050.html.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5571 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 1+
Msrc/files.c | 6+++++-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,6 +1,7 @@ 2016-01-17 Benno Schulenberg <bensberg@justemail.net> * src/global.c: Fix typo in #ifndef symbol. Reported by Frank. * doc/syntax/nanorc.nanorc: Remove '+' as only one menu is allowed. + * src/files.c (load_poshistory): Limit the number of loaded items. 2016-01-17 Mike Frysinger <vapier@gentoo.org> * doc/syntax/nanorc.nanorc: Allow inline comments with key bindings. diff --git a/src/files.c b/src/files.c @@ -3245,7 +3245,7 @@ void load_poshistory(void) } else { char *line = NULL, *lineptr, *xptr; size_t buf_len = 0; - ssize_t read; + ssize_t read, count = 0; poshiststruct *record_ptr = NULL, *newrecord; /* Read and parse each line, and store the extracted data. */ @@ -3271,6 +3271,10 @@ void load_poshistory(void) record_ptr->next = newrecord; record_ptr = newrecord; + + /* Impose a limit, so the file will not grow indefinitely. */ + if (++count > 200) + position_history = position_history->next; } fclose(hist); free(line);