Mercurial > vim
comparison src/quickfix.c @ 27752:c1d1639b52dd v8.2.4402
patch 8.2.4402: missing parenthesis may cause unexpected problems
Commit: https://github.com/vim/vim/commit/ae6f1d8b14c2f63811ee83ef14e32086fb3e9b83
Author: kylo252 <59826753+kylo252@users.noreply.github.com>
Date: Wed Feb 16 19:24:07 2022 +0000
patch 8.2.4402: missing parenthesis may cause unexpected problems
Problem: Missing parenthesis may cause unexpected problems.
Solution: Add more parenthesis is macros. (closes https://github.com/vim/vim/issues/9788)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Feb 2022 20:30:03 +0100 |
parents | bf540a32439a |
children | 44a552776007 |
comparison
equal
deleted
inserted
replaced
27751:c9330d10419b | 27752:c1d1639b52dd |
---|---|
187 static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start); | 187 static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start); |
188 static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start); | 188 static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start); |
189 static qf_info_T *ll_get_or_alloc_list(win_T *); | 189 static qf_info_T *ll_get_or_alloc_list(win_T *); |
190 | 190 |
191 // Quickfix window check helper macro | 191 // Quickfix window check helper macro |
192 #define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL) | 192 #define IS_QF_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref == NULL) |
193 // Location list window check helper macro | 193 // Location list window check helper macro |
194 #define IS_LL_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) | 194 #define IS_LL_WINDOW(wp) (bt_quickfix((wp)->w_buffer) && (wp)->w_llist_ref != NULL) |
195 | 195 |
196 // Quickfix and location list stack check helper macros | 196 // Quickfix and location list stack check helper macros |
197 #define IS_QF_STACK(qi) (qi->qfl_type == QFLT_QUICKFIX) | 197 #define IS_QF_STACK(qi) ((qi)->qfl_type == QFLT_QUICKFIX) |
198 #define IS_LL_STACK(qi) (qi->qfl_type == QFLT_LOCATION) | 198 #define IS_LL_STACK(qi) ((qi)->qfl_type == QFLT_LOCATION) |
199 #define IS_QF_LIST(qfl) (qfl->qfl_type == QFLT_QUICKFIX) | 199 #define IS_QF_LIST(qfl) ((qfl)->qfl_type == QFLT_QUICKFIX) |
200 #define IS_LL_LIST(qfl) (qfl->qfl_type == QFLT_LOCATION) | 200 #define IS_LL_LIST(qfl) ((qfl)->qfl_type == QFLT_LOCATION) |
201 | 201 |
202 /* | 202 /* |
203 * Return location list for window 'wp' | 203 * Return location list for window 'wp' |
204 * For location list window, return the referenced location list | 204 * For location list window, return the referenced location list |
205 */ | 205 */ |
206 #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist) | 206 #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? (wp)->w_llist_ref : (wp)->w_llist) |
207 | 207 |
208 // Macro to loop through all the items in a quickfix list | 208 // Macro to loop through all the items in a quickfix list |
209 // Quickfix item index starts from 1, so i below starts at 1 | 209 // Quickfix item index starts from 1, so i below starts at 1 |
210 #define FOR_ALL_QFL_ITEMS(qfl, qfp, i) \ | 210 #define FOR_ALL_QFL_ITEMS(qfl, qfp, i) \ |
211 for (i = 1, qfp = qfl->qf_start; \ | 211 for ((i) = 1, (qfp) = (qfl)->qf_start; \ |
212 !got_int && i <= qfl->qf_count && qfp != NULL; \ | 212 !got_int && (i) <= (qfl)->qf_count && (qfp) != NULL; \ |
213 ++i, qfp = qfp->qf_next) | 213 ++(i), (qfp) = (qfp)->qf_next) |
214 | 214 |
215 /* | 215 /* |
216 * Looking up a buffer can be slow if there are many. Remember the last one | 216 * Looking up a buffer can be slow if there are many. Remember the last one |
217 * to make this a lot faster if there are multiple matches in the same file. | 217 * to make this a lot faster if there are multiple matches in the same file. |
218 */ | 218 */ |