buffer: move BUFEMPTY to a function

This commit is contained in:
Thomas Vigouroux
2020-11-24 08:48:05 +01:00
parent 763c852812
commit 7970631fa0
14 changed files with 28 additions and 21 deletions

View File

@@ -9,6 +9,7 @@
#include "nvim/func_attr.h"
#include "nvim/eval.h"
#include "nvim/macros.h"
#include "nvim/memline.h"
// Values for buflist_getfile()
enum getf_values {
@@ -128,4 +129,10 @@ static inline void buf_inc_changedtick(buf_T *const buf)
buf_set_changedtick(buf, buf_get_changedtick(buf) + 1);
}
static inline bool buf_is_empty(buf_T *buf)
{
return buf->b_ml.ml_line_count == 1
&& *ml_get_buf(buf, (linenr_T)1, false) == '\0';
}
#endif // NVIM_BUFFER_H