Mercurial > vim
comparison src/main.c @ 9487:69ed2c9d34a6 v7.4.2024
commit https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 10 22:11:16 2016 +0200
patch 7.4.2024
Problem: More buf_valid() calls can be optimized.
Solution: Use bufref_valid() instead.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 10 Jul 2016 22:15:06 +0200 |
parents | 1003973c99df |
children | b2aada04d84e |
comparison
equal
deleted
inserted
replaced
9486:b931ed8a6782 | 9487:69ed2c9d34a6 |
---|---|
1458 | 1458 |
1459 /* Trigger BufUnload for buffers that are loaded */ | 1459 /* Trigger BufUnload for buffers that are loaded */ |
1460 for (buf = firstbuf; buf != NULL; buf = buf->b_next) | 1460 for (buf = firstbuf; buf != NULL; buf = buf->b_next) |
1461 if (buf->b_ml.ml_mfp != NULL) | 1461 if (buf->b_ml.ml_mfp != NULL) |
1462 { | 1462 { |
1463 bufref_T bufref; | |
1464 | |
1465 set_bufref(&bufref, buf); | |
1463 apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, | 1466 apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, |
1464 FALSE, buf); | 1467 FALSE, buf); |
1465 if (!buf_valid(buf)) /* autocmd may delete the buffer */ | 1468 if (!bufref_valid(&bufref)) |
1469 /* autocmd deleted the buffer */ | |
1466 break; | 1470 break; |
1467 } | 1471 } |
1468 apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); | 1472 apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); |
1469 } | 1473 } |
1470 #endif | 1474 #endif |