mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +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:
@@ -2189,7 +2189,7 @@ static inline ShaDaWriteResult shada_read_when_writing(ShaDaReadDef *const sd_re
|
||||
k = kh_put(file_marks, &wms->file_marks, fname, &kh_ret);
|
||||
FileMarks *const filemarks = &kh_val(&wms->file_marks, k);
|
||||
if (kh_ret > 0) {
|
||||
memset(filemarks, 0, sizeof(*filemarks));
|
||||
CLEAR_POINTER(filemarks);
|
||||
}
|
||||
if (entry.timestamp > filemarks->greatest_timestamp) {
|
||||
filemarks->greatest_timestamp = entry.timestamp;
|
||||
@@ -2752,7 +2752,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, ShaDaReadDef
|
||||
k = kh_put(file_marks, &wms->file_marks, fname, &kh_ret);
|
||||
FileMarks *const filemarks = &kh_val(&wms->file_marks, k);
|
||||
if (kh_ret > 0) {
|
||||
memset(filemarks, 0, sizeof(*filemarks));
|
||||
CLEAR_POINTER(filemarks);
|
||||
}
|
||||
do {
|
||||
fmark_T fm;
|
||||
@@ -3478,7 +3478,7 @@ shada_read_next_item_start:
|
||||
// data union are NULL so they are safe to xfree(). This is needed in case
|
||||
// somebody calls goto shada_read_next_item_error before anything is set in
|
||||
// the switch.
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
CLEAR_POINTER(entry);
|
||||
if (sd_reader->eof) {
|
||||
return kSDReadStatusFinished;
|
||||
}
|
||||
|
Reference in New Issue
Block a user