mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)
vim-patch:8.2.0559: clearing a struct is verbose
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
a80faa8930
This commit is contained in:
@@ -178,7 +178,7 @@ static inline void hist_free_entry(histentry_T *hisptr)
|
||||
static inline void clear_hist_entry(histentry_T *hisptr)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
memset(hisptr, 0, sizeof(*hisptr));
|
||||
CLEAR_POINTER(hisptr);
|
||||
}
|
||||
|
||||
/// Check if command line 'str' is already in history.
|
||||
@@ -714,7 +714,7 @@ const void *hist_iter(const void *const iter, const uint8_t history_type, const
|
||||
}
|
||||
*hist = *hiter;
|
||||
if (zero) {
|
||||
memset(hiter, 0, sizeof(*hiter));
|
||||
CLEAR_POINTER(hiter);
|
||||
}
|
||||
if (hiter == hlast) {
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user