diff options
author | QC <qball@gmpclient.org> | 2014-05-25 17:55:27 +0200 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2014-05-25 17:55:27 +0200 |
commit | cba893f5002375b4c91b527af4880ff54370b965 (patch) | |
tree | b065a84ee7e0914fcdb932f43ab8f9e0c725d72f /source/history.c | |
parent | fb56250d1859ae3f6fd1b3dfa9fee922495ecd19 (diff) |
Fix history becoming stuck.
Diffstat (limited to 'source/history.c')
-rw-r--r-- | source/history.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/history.c b/source/history.c index 0a7f46bb..a41a44bc 100644 --- a/source/history.c +++ b/source/history.c @@ -58,13 +58,16 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i // Sort the list before writing out. qsort ( list, length, sizeof ( _element* ), __element_sort_func ); + // Get minimum index. + int min_value = list[length-1]->index; + // Set the max length of the list. length = ( length > HISTORY_MAX_ENTRIES ) ? HISTORY_MAX_ENTRIES : length; // Write out entries. for ( unsigned int iter = 0; iter < length; iter++ ) { - fprintf ( fd, "%ld %s\n", list[iter]->index, list[iter]->name ); + fprintf ( fd, "%ld %s\n", list[iter]->index-min_value, list[iter]->name ); } } |