aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-07 21:32:11 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-17 07:02:44 -0300
commitb4efff652388260b548324f870201a5804e097f0 (patch)
treeb7afb575a4640ef28e06b6a6519839420996a492 /src/nvim/fold.c
parent659cd0e99a0993497279ef8538956eec9f2fc374 (diff)
downloadrneovim-b4efff652388260b548324f870201a5804e097f0.tar.gz
rneovim-b4efff652388260b548324f870201a5804e097f0.tar.bz2
rneovim-b4efff652388260b548324f870201a5804e097f0.zip
Replace ga->ga_len > 0 checks with !GA_EMPTY(ga)
Used Coccinelle to perform the changes ```diff @@ expression E; @@ <... ( - E.ga_len > 0 + !GA_EMPTY(&E) | - E->ga_len > 0 + !GA_EMPTY(E) ) ...> ``` `spatch --in-place --sp-file ga_empty.cocci <C_FILE>`
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index f5801205d7..8320b905b2 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -138,7 +138,7 @@ int hasAnyFolding(win_T *win)
{
/* very simple now, but can become more complex later */
return win->w_p_fen
- && (!foldmethodIsManual(win) || win->w_folds.ga_len > 0);
+ && (!foldmethodIsManual(win) || !GA_EMPTY(&win->w_folds));
}
/* hasFolding() {{{2 */
@@ -2655,7 +2655,7 @@ static void foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2)
foldMerge(fp3, gap2, fp4);
/* Move nested folds in fp2 to the end of fp1. */
- if (gap2->ga_len > 0) {
+ if (!GA_EMPTY(gap2)) {
ga_grow(gap1, gap2->ga_len);
for (idx = 0; idx < gap2->ga_len; ++idx) {
((fold_T *)gap1->ga_data)[gap1->ga_len]
@@ -2982,7 +2982,7 @@ static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap, linenr_T off
fp = (fold_T *)gap->ga_data;
for (i = 0; i < gap->ga_len; i++) {
if (fp->fd_flags != FD_LEVEL) {
- if (fp->fd_nested.ga_len > 0) {
+ if (!GA_EMPTY(&fp->fd_nested)) {
/* open nested folds while this fold is open */
if (fprintf(fd, "%" PRId64, (int64_t)(fp->fd_top + off)) < 0
|| put_eol(fd) == FAIL