diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-04-25 04:12:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-24 20:12:47 -0600 |
commit | c58219413514caf035ac52eb85b84b1ff31d4722 (patch) | |
tree | 1db3c26ab8a0c05653213736742f8fd6626b9c70 /src/nvim/getchar.c | |
parent | 933274c438107adadde5ff854340ed1fae18d3fe (diff) | |
download | rneovim-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/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 85479b220a..f2df7b49fd 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -397,6 +397,7 @@ static void start_stuff(void) * Return TRUE if the stuff buffer is empty. */ int stuff_empty(void) + FUNC_ATTR_PURE { return (readbuf1.bh_first.b_next == NULL && readbuf2.bh_first.b_next == NULL); } @@ -406,6 +407,7 @@ int stuff_empty(void) * redbuf2. */ int readbuf1_empty(void) + FUNC_ATTR_PURE { return (readbuf1.bh_first.b_next == NULL); } @@ -1025,10 +1027,10 @@ int ins_char_typebuf(int c, int modifier) /// /// @param tb_change_cnt old value of typebuf.tb_change_cnt bool typebuf_changed(int tb_change_cnt) + FUNC_ATTR_PURE { return tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt - || typebuf_was_filled - ); + || typebuf_was_filled); } /* @@ -1036,6 +1038,7 @@ bool typebuf_changed(int tb_change_cnt) * not been typed (result from a mapping or come from ":normal"). */ int typebuf_typed(void) + FUNC_ATTR_PURE { return typebuf.tb_maplen == 0; } @@ -1044,6 +1047,7 @@ int typebuf_typed(void) * Return the number of characters that are mapped (or not typed). */ int typebuf_maplen(void) + FUNC_ATTR_PURE { return typebuf.tb_maplen; } @@ -1403,6 +1407,7 @@ void close_all_scripts(void) * Return TRUE when reading keys from a script file. */ int using_script(void) + FUNC_ATTR_PURE { return scriptin[curscript] != NULL; } |