Mercurial > vim
comparison src/buffer.c @ 10118:5d77565e6222 v7.4.2330
commit https://github.com/vim/vim/commit/030cddc7ec0c3d2fe3969140cd1b92b2f18633c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 4 23:41:42 2016 +0200
patch 7.4.2330
Problem: Coverity complains about not checking curwin to be NULL.
Solution: Use firstwin to avoid the warning.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 04 Sep 2016 23:45:05 +0200 |
parents | aa2219afd1c2 |
children | 4647267906cc |
comparison
equal
deleted
inserted
replaced
10117:0e4f59f9bbae | 10118:5d77565e6222 |
---|---|
705 { | 705 { |
706 #ifdef FEAT_AUTOCMD | 706 #ifdef FEAT_AUTOCMD |
707 int is_curbuf = (buf == curbuf); | 707 int is_curbuf = (buf == curbuf); |
708 bufref_T bufref; | 708 bufref_T bufref; |
709 # ifdef FEAT_WINDOWS | 709 # ifdef FEAT_WINDOWS |
710 int is_curwin = (curwin!= NULL && curwin->w_buffer == buf); | 710 int is_curwin = (curwin != NULL && curwin->w_buffer == buf); |
711 win_T *the_curwin = curwin; | 711 win_T *the_curwin = curwin; |
712 tabpage_T *the_curtab = curtab; | 712 tabpage_T *the_curtab = curtab; |
713 # endif | 713 # endif |
714 | 714 |
715 /* Make sure the buffer isn't closed by autocommands. */ | 715 /* Make sure the buffer isn't closed by autocommands. */ |
770 #ifdef FEAT_DIFF | 770 #ifdef FEAT_DIFF |
771 diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ | 771 diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */ |
772 #endif | 772 #endif |
773 #ifdef FEAT_SYN_HL | 773 #ifdef FEAT_SYN_HL |
774 /* Remove any ownsyntax, unless exiting. */ | 774 /* Remove any ownsyntax, unless exiting. */ |
775 if (firstwin != NULL && curwin->w_buffer == buf) | 775 if (curwin != NULL && curwin->w_buffer == buf) |
776 reset_synblock(curwin); | 776 reset_synblock(curwin); |
777 #endif | 777 #endif |
778 | 778 |
779 #ifdef FEAT_FOLDING | 779 #ifdef FEAT_FOLDING |
780 /* No folds in an empty buffer. */ | 780 /* No folds in an empty buffer. */ |
786 FOR_ALL_TAB_WINDOWS(tp, win) | 786 FOR_ALL_TAB_WINDOWS(tp, win) |
787 if (win->w_buffer == buf) | 787 if (win->w_buffer == buf) |
788 clearFolding(win); | 788 clearFolding(win); |
789 } | 789 } |
790 # else | 790 # else |
791 if (curwin->w_buffer == buf) | 791 if (curwin != NULL && curwin->w_buffer == buf) |
792 clearFolding(curwin); | 792 clearFolding(curwin); |
793 # endif | 793 # endif |
794 #endif | 794 #endif |
795 | 795 |
796 #ifdef FEAT_TCL | 796 #ifdef FEAT_TCL |