mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
buffer: add attributes to pure functions
This commit is contained in:
parent
01e3690ca8
commit
b388f46266
@ -5171,18 +5171,21 @@ chk_modeline(
|
||||
|
||||
// Return true if "buf" is a help buffer.
|
||||
bool bt_help(const buf_T *const buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return buf != NULL && buf->b_help;
|
||||
}
|
||||
|
||||
// Return true if "buf" is the quickfix buffer.
|
||||
bool bt_quickfix(const buf_T *const buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return buf != NULL && buf->b_p_bt[0] == 'q';
|
||||
}
|
||||
|
||||
// Return true if "buf" is a terminal buffer.
|
||||
bool bt_terminal(const buf_T *const buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return buf != NULL && buf->b_p_bt[0] == 't';
|
||||
}
|
||||
@ -5190,6 +5193,7 @@ bool bt_terminal(const buf_T *const buf)
|
||||
// Return true if "buf" is a "nofile", "acwrite" or "terminal" buffer.
|
||||
// This means the buffer name is not a file name.
|
||||
bool bt_nofile(const buf_T *const buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|
||||
|| buf->b_p_bt[0] == 'a' || buf->terminal);
|
||||
@ -5197,11 +5201,13 @@ bool bt_nofile(const buf_T *const buf)
|
||||
|
||||
// Return true if "buf" is a "nowrite", "nofile" or "terminal" buffer.
|
||||
bool bt_dontwrite(const buf_T *const buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->terminal);
|
||||
}
|
||||
|
||||
bool bt_dontwrite_msg(const buf_T *const buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (bt_dontwrite(buf)) {
|
||||
EMSG(_("E382: Cannot write, 'buftype' option is set"));
|
||||
|
Loading…
Reference in New Issue
Block a user