1
1

tweaks: strip a parameter that is equivalent to 'openfile' for both calls

Этот коммит содержится в:
Benno Schulenberg 2020-03-08 12:54:47 +01:00
родитель 01bc0148c0
Коммит 2428c5cbe6
3 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -593,7 +593,7 @@ void close_buffer(void)
free(orphan->current_stat); free(orphan->current_stat);
free(orphan->lock_filename); free(orphan->lock_filename);
/* Free the undo stack. */ /* Free the undo stack. */
discard_until(NULL, orphan); discard_until(NULL);
#endif #endif
openfile = orphan->prev; openfile = orphan->prev;

Просмотреть файл

@ -502,7 +502,7 @@ void do_undo(void);
void do_redo(void); void do_redo(void);
void do_enter(void); void do_enter(void);
#ifndef NANO_TINY #ifndef NANO_TINY
void discard_until(const undostruct *thisitem, openfilestruct *thefile); void discard_until(const undostruct *thisitem);
void add_undo(undo_type action, const char *message); void add_undo(undo_type action, const char *message);
void update_multiline_undo(ssize_t lineno, char *indentation); void update_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action); void update_undo(undo_type action);

Просмотреть файл

@ -900,13 +900,13 @@ void do_enter(void)
#ifndef NANO_TINY #ifndef NANO_TINY
/* Discard undo items that are newer than the given one, or all if NULL. */ /* Discard undo items that are newer than the given one, or all if NULL. */
void discard_until(const undostruct *thisitem, openfilestruct *thefile) void discard_until(const undostruct *thisitem)
{ {
undostruct *dropit = thefile->undotop; undostruct *dropit = openfile->undotop;
groupstruct *group; groupstruct *group;
while (dropit != NULL && dropit != thisitem) { while (dropit != NULL && dropit != thisitem) {
thefile->undotop = dropit->next; openfile->undotop = dropit->next;
free(dropit->strdata); free(dropit->strdata);
free_lines(dropit->cutbuffer); free_lines(dropit->cutbuffer);
group = dropit->grouping; group = dropit->grouping;
@ -918,14 +918,14 @@ void discard_until(const undostruct *thisitem, openfilestruct *thefile)
group = next; group = next;
} }
free(dropit); free(dropit);
dropit = thefile->undotop; dropit = openfile->undotop;
} }
/* Adjust the pointer to the top of the undo stack. */ /* Adjust the pointer to the top of the undo stack. */
thefile->current_undo = (undostruct *)thisitem; openfile->current_undo = (undostruct *)thisitem;
/* Prevent a chain of editing actions from continuing. */ /* Prevent a chain of editing actions from continuing. */
thefile->last_action = OTHER; openfile->last_action = OTHER;
} }
/* Add a new undo item of the given type to the top of the current pile. */ /* Add a new undo item of the given type to the top of the current pile. */
@ -948,7 +948,7 @@ void add_undo(undo_type action, const char *message)
u->xflags = 0; u->xflags = 0;
/* Blow away any undone items. */ /* Blow away any undone items. */
discard_until(openfile->current_undo, openfile); discard_until(openfile->current_undo);
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING
/* If some action caused automatic long-line wrapping, insert the /* If some action caused automatic long-line wrapping, insert the