aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-04-25 04:12:47 +0200
committerGitHub <noreply@github.com>2022-04-24 20:12:47 -0600
commitc58219413514caf035ac52eb85b84b1ff31d4722 (patch)
tree1db3c26ab8a0c05653213736742f8fd6626b9c70 /src/nvim/ex_cmds2.c
parent933274c438107adadde5ff854340ed1fae18d3fe (diff)
downloadrneovim-c58219413514caf035ac52eb85b84b1ff31d4722.tar.gz
rneovim-c58219413514caf035ac52eb85b84b1ff31d4722.tar.bz2
rneovim-c58219413514caf035ac52eb85b84b1ff31d4722.zip
refactor: add pure attribute to pure functions (#18165)
This will allow the compilers that support the pure attribute to make further optimizations.
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index ac1d760bce..04fcb0304e 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -201,6 +201,7 @@ static char *pexpand_cmds[] = {
/// Function given to ExpandGeneric() to obtain the profile command
/// specific expansion.
char_u *get_profile_name(expand_T *xp, int idx)
+ FUNC_ATTR_PURE
{
switch (pexpand_what) {
case PEXP_SUBCMD:
@@ -439,6 +440,7 @@ static void script_dump_profile(FILE *fd)
/// @return true when a function defined in the current script should be
/// profiled.
bool prof_def_func(void)
+ FUNC_ATTR_PURE
{
if (current_sctx.sc_sid > 0) {
return SCRIPT_ITEM(current_sctx.sc_sid).sn_pr_force;
@@ -1732,6 +1734,7 @@ int *source_dbg_tick(void *cookie)
/// @return the nesting level for a source cookie.
int source_level(void *cookie)
+ FUNC_ATTR_PURE
{
return ((struct source_cookie *)cookie)->level;
}
@@ -2288,6 +2291,7 @@ void free_scriptnames(void)
#endif
linenr_T get_sourced_lnum(LineGetter fgetline, void *cookie)
+ FUNC_ATTR_PURE
{
return fgetline == getsourceline
? ((struct source_cookie *)cookie)->sourcing_lnum