aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/context.c
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2022-04-11 18:29:48 +0200
committerDundar Göc <gocdundar@gmail.com>2022-04-13 22:12:12 +0200
commit0fb571e3b5043f136f2394d84b942b8c93fdde45 (patch)
tree897846d0a34979ccf7db46c53926aafaea437f9c /src/nvim/context.c
parent9a357043333cee38846a7a9a764cdae96d0856fd (diff)
downloadrneovim-0fb571e3b5043f136f2394d84b942b8c93fdde45.tar.gz
rneovim-0fb571e3b5043f136f2394d84b942b8c93fdde45.tar.bz2
rneovim-0fb571e3b5043f136f2394d84b942b8c93fdde45.zip
refactor: add pure attribute to pure functions
This will allow compilers that support the pure attribute to make further optimizations to functions.
Diffstat (limited to 'src/nvim/context.c')
-rw-r--r--src/nvim/context.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/context.c b/src/nvim/context.c
index 9434b4e0ea..c30a05a3c8 100644
--- a/src/nvim/context.c
+++ b/src/nvim/context.c
@@ -33,6 +33,7 @@ void ctx_free_all(void)
/// Returns the size of the context stack.
size_t ctx_size(void)
+ FUNC_ATTR_PURE
{
return kv_size(ctx_stack);
}
@@ -40,6 +41,7 @@ size_t ctx_size(void)
/// Returns pointer to Context object with given zero-based index from the top
/// of context stack or NULL if index is out of bounds.
Context *ctx_get(size_t index)
+ FUNC_ATTR_PURE
{
if (index < kv_size(ctx_stack)) {
return &kv_Z(ctx_stack, index);