mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 15:08:35 +00:00
channels: refactor
This commit is contained in:
@@ -847,6 +847,30 @@ bool tv_callback_equal(const Callback *const cb1, const Callback *const cb2)
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Unref/free callback
|
||||
void callback_free(Callback *const callback)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
switch (callback->type) {
|
||||
case kCallbackFuncref: {
|
||||
func_unref(callback->data.funcref);
|
||||
xfree(callback->data.funcref);
|
||||
break;
|
||||
}
|
||||
case kCallbackPartial: {
|
||||
partial_unref(callback->data.partial);
|
||||
break;
|
||||
}
|
||||
case kCallbackNone: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
callback->type = kCallbackNone;
|
||||
}
|
||||
|
||||
/// Remove watcher from a dictionary
|
||||
///
|
||||
/// @param dict Dictionary to remove watcher from.
|
||||
|
Reference in New Issue
Block a user