tweaks: elide three parameters, as they are the same for both calls

master
Benno Schulenberg 2020-05-08 10:40:03 +02:00
parent 42ca89039a
commit 982e226c3f
3 changed files with 11 additions and 12 deletions

View File

@ -506,14 +506,14 @@ void reload_positions_if_needed(void)
}
}
/* Update the recorded last file positions, given a filename, a line
* and a column. If no entry is found, add a new one at the end. */
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
/* Update the recorded last file positions with the current position in the
* current buffer. If no existing entry is found, add a new one at the end. */
void update_poshistory(void)
{
poshiststruct *posptr, *theone, *posprev = NULL;
char *fullpath = get_full_path(filename);
char *fullpath = get_full_path(openfile->filename);
if (fullpath == NULL || *filename == '\0') {
if (fullpath == NULL || openfile->filename[0] == '\0') {
free(fullpath);
return;
}
@ -528,7 +528,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
}
/* Don't record files that have the default cursor position. */
if (lineno == 1 && xpos == 1) {
if (openfile->current->lineno == 1 && openfile->current_x == 0) {
if (posptr != NULL) {
if (posprev == NULL)
position_history = posptr->next;
@ -564,8 +564,8 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
}
/* Store the last cursor position. */
theone->lineno = lineno;
theone->xno = xpos;
theone->lineno = openfile->current->lineno;
theone->xno = xplustabs() + 1;
theone->next = NULL;
free(fullpath);

View File

@ -257,7 +257,7 @@ void finish(void)
if (ISSET(HISTORYLOG))
save_history();
if (ISSET(POSITIONLOG) && openfile)
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
update_poshistory();
#endif
/* Get out. */
@ -768,8 +768,7 @@ void close_and_go(void)
if (openfile != openfile->next) {
#ifdef ENABLE_HISTORIES
if (ISSET(POSITIONLOG))
update_poshistory(openfile->filename,
openfile->current->lineno, xplustabs() + 1);
update_poshistory();
#endif
switch_to_next_buffer();
openfile = openfile->prev;

View File

@ -357,7 +357,7 @@ bool have_statedir(void);
void load_history(void);
void save_history(void);
void load_poshistory(void);
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
void update_poshistory(void);
bool has_old_position(const char *file, ssize_t *line, ssize_t *column);
#endif