patch 7.4.2024
Problem: More buf_valid() calls can be optimized.
Solution: Use bufref_valid() instead.
diff --git a/src/netbeans.c b/src/netbeans.c
index e326af8..736bb16 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -2177,10 +2177,15 @@
#endif
)
{
+#ifdef FEAT_AUTOCMD
+ bufref_T bufref;
+
+ set_bufref(&bufref, buf->bufp);
+#endif
buf_write_all(buf->bufp, FALSE);
#ifdef FEAT_AUTOCMD
/* an autocommand may have deleted the buffer */
- if (!buf_valid(buf->bufp))
+ if (!bufref_valid(&bufref))
buf->bufp = NULL;
#endif
}