aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9581b81456..b60886704e 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1,18 +1,8 @@
/*
- *
- * VIM - Vi IMproved by Bram Moolenaar
- *
- * Do ":help uganda" in Vim to read copying and usage conditions.
- * Do ":help credits" in Vim to see a list of people who contributed.
- * See README.txt for an overview of the Vim source code.
- */
-
-/*
* eval.c: Expression evaluation.
*/
#include <assert.h>
-#include <errno.h>
#include <inttypes.h>
#include <stdarg.h>
#include <string.h>
@@ -383,6 +373,9 @@ static struct vimvar {
{VV_NAME("progpath", VAR_STRING), VV_RO},
{VV_NAME("command_output", VAR_STRING), 0},
{VV_NAME("completed_item", VAR_DICT), VV_RO},
+ {VV_NAME("option_new", VAR_STRING), VV_RO},
+ {VV_NAME("option_old", VAR_STRING), VV_RO},
+ {VV_NAME("option_type", VAR_STRING), VV_RO},
{VV_NAME("msgpack_types", VAR_DICT), VV_RO},
};
@@ -5658,6 +5651,14 @@ bool garbage_collect(void)
ABORTING(set_ref_in_ht)(&fc->l_avars.dv_hashtab, copyID, NULL);
}
+ // Jobs
+ {
+ TerminalJobData *data;
+ map_foreach_value(jobs, data, {
+ ABORTING(set_ref_dict)(data->self, copyID);
+ })
+ }
+
// v: vars
ABORTING(set_ref_in_ht)(&vimvarht, copyID, NULL);
@@ -5735,8 +5736,7 @@ static int free_unref_items(int copyID)
// Go through the list of dicts and free items without the copyID.
// Don't free dicts that are referenced internally.
for (dict_T *dd = first_dict; dd != NULL; ) {
- if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
- && !dd->internal_refcount) {
+ if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) {
// Free the Dictionary and ordinary items it contains, but don't
// recurse into Lists and Dictionaries, they will be in the list
// of dicts or list of lists. */
@@ -5977,7 +5977,6 @@ dict_T *dict_alloc(void) FUNC_ATTR_NONNULL_RET
d->dv_scope = 0;
d->dv_refcount = 0;
d->dv_copyID = 0;
- d->internal_refcount = 0;
QUEUE_INIT(&d->watchers);
return d;
@@ -21248,9 +21247,13 @@ void ex_oldfiles(exarg_T *eap)
}
}
-
-
-
+// reset v:option_new, v:option_old and v:option_type
+void reset_v_option_vars(void)
+{
+ set_vim_var_string(VV_OPTION_NEW, NULL, -1);
+ set_vim_var_string(VV_OPTION_OLD, NULL, -1);
+ set_vim_var_string(VV_OPTION_TYPE, NULL, -1);
+}
/*
* Adjust a filename, according to a string of modifiers.
@@ -21623,7 +21626,6 @@ static inline bool common_job_callbacks(dict_T *vopts, ufunc_T **on_stdout,
if (get_dict_callback(vopts, "on_stdout", on_stdout)
&& get_dict_callback(vopts, "on_stderr", on_stderr)
&& get_dict_callback(vopts, "on_exit", on_exit)) {
- vopts->internal_refcount++;
vopts->dv_refcount++;
return true;
}
@@ -21685,7 +21687,6 @@ static inline void free_term_job_data_event(void **argv)
}
if (data->self) {
- data->self->internal_refcount--;
dict_unref(data->self);
}
queue_free(data->events);
@@ -21936,7 +21937,7 @@ typval_T eval_call_provider(char *provider, char *method, list_T *arguments)
true,
NULL);
- arguments->lv_refcount--;
+ list_unref(arguments);
// Restore caller scope information
restore_funccal(provider_caller_scope.funccalp);
provider_caller_scope = saved_provider_caller_scope;