diff options
author | Abdelhakeem <abdelhakeem.osama@hotmail.com> | 2019-08-23 14:52:18 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-09-01 21:17:14 +0200 |
commit | b447bdb68ceda05b3181bec8572ff22ec588ee0d (patch) | |
tree | 19ab5a052ba30de80692e46b13af067cb68ff749 /src | |
parent | 2d3f39c72957edbc8a2af9c04942fdcfd90f63e5 (diff) | |
download | rneovim-b447bdb68ceda05b3181bec8572ff22ec588ee0d.tar.gz rneovim-b447bdb68ceda05b3181bec8572ff22ec588ee0d.tar.bz2 rneovim-b447bdb68ceda05b3181bec8572ff22ec588ee0d.zip |
fixup! eval: add wait() test
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b1012961f1..79e67f6d7b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -10895,15 +10895,11 @@ static void f_getwininfo(typval_T *argvars, typval_T *rettv, FunPtr fptr) // Dummy timer callback. Used by f_wait(). static void dummy_timer_due_cb(TimeWatcher *tw, void *data) { - if (!uv_timer_get_repeat(&tw->uv)) { - time_watcher_start(tw, dummy_timer_due_cb, 0, 0); - } } // Dummy timer close callback. Used by f_wait(). static void dummy_timer_close_cb(TimeWatcher *tw, void *data) { - multiqueue_free(tw->events); xfree(tw); } @@ -10914,7 +10910,7 @@ static void f_wait(typval_T *argvars, typval_T *rettv, FunPtr fptr) rettv->vval.v_number = -1; if (argvars[0].v_type != VAR_NUMBER) { - EMSG2(_(e_invarg2), "First argument of wait() must be a number"); + EMSG2(_(e_invargval), "1"); return; } @@ -10928,20 +10924,18 @@ static void f_wait(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (tv_interval->v_type == VAR_NUMBER) { interval = tv_interval->vval.v_number; - if (interval < 0) { - EMSG2(_(e_invarg2), - "Third argument of wait() must be a non-negative number"); + if (interval <= 0) { + EMSG2(_(e_invargval), "3"); return; } // Start dummy timer tw = xmalloc(sizeof(TimeWatcher)); time_watcher_init(&main_loop, tw, NULL); - tw->events = multiqueue_new_child(main_loop.events); + tw->events = main_loop.events; tw->blockable = true; time_watcher_start(tw, dummy_timer_due_cb, interval, interval); } else if (tv_interval->v_type != VAR_UNKNOWN) { - EMSG2(_(e_invarg2), - "Third argument of wait() must be a non-negative number"); + EMSG2(_(e_invargval), "3"); return; } |