aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/arglist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/arglist.c')
-rw-r--r--src/nvim/arglist.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 700bfc1655..e3a2db75e5 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -346,12 +346,7 @@ static void alist_add_list(int count, char **files, int after, bool will_edit)
int old_argcount = ARGCOUNT;
ga_grow(&ALIST(curwin)->al_ga, count);
if (check_arglist_locked() != FAIL) {
- if (after < 0) {
- after = 0;
- }
- if (after > ARGCOUNT) {
- after = ARGCOUNT;
- }
+ after = MIN(MAX(after, 0), ARGCOUNT);
if (after < ARGCOUNT) {
memmove(&(ARGLIST[after + count]), &(ARGLIST[after]),
(size_t)(ARGCOUNT - after) * sizeof(aentry_T));