diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-12 19:37:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-12 19:37:17 +0200 |
commit | a80faa8930ed5a554beeb2727762538873135e83 (patch) | |
tree | e797605e0c781214543fcba103cffede7af611cd /src/undo.c | |
parent | 82de464f763d6e6d89229be03ce7c6d02fd5fb59 (diff) | |
download | vim-git-a80faa8930ed5a554beeb2727762538873135e83.tar.gz |
patch 8.2.0559: clearing a struct is verbosev8.2.0559
Problem: Clearing a struct is verbose.
Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
Diffstat (limited to 'src/undo.c')
-rw-r--r-- | src/undo.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/undo.c b/src/undo.c index 54a6e1c5b..c5ce306ca 100644 --- a/src/undo.c +++ b/src/undo.c @@ -662,7 +662,7 @@ u_savecommon( uep = U_ALLOC_LINE(sizeof(u_entry_T)); if (uep == NULL) goto nomem; - vim_memset(uep, 0, sizeof(u_entry_T)); + CLEAR_POINTER(uep); #ifdef U_DEBUG uep->ue_magic = UE_MAGIC; #endif @@ -1288,7 +1288,7 @@ unserialize_uhp(bufinfo_T *bi, char_u *file_name) uhp = U_ALLOC_LINE(sizeof(u_header_T)); if (uhp == NULL) return NULL; - vim_memset(uhp, 0, sizeof(u_header_T)); + CLEAR_POINTER(uhp); #ifdef U_DEBUG uhp->uh_magic = UH_MAGIC; #endif @@ -1405,7 +1405,7 @@ unserialize_uep(bufinfo_T *bi, int *error, char_u *file_name) uep = U_ALLOC_LINE(sizeof(u_entry_T)); if (uep == NULL) return NULL; - vim_memset(uep, 0, sizeof(u_entry_T)); + CLEAR_POINTER(uep); #ifdef U_DEBUG uep->ue_magic = UE_MAGIC; #endif @@ -1532,7 +1532,7 @@ u_write_undo( #endif bufinfo_T bi; - vim_memset(&bi, 0, sizeof(bi)); + CLEAR_FIELD(bi); if (name == NULL) { @@ -1814,7 +1814,7 @@ u_read_undo(char_u *name, char_u *hash, char_u *orig_name UNUSED) #endif bufinfo_T bi; - vim_memset(&bi, 0, sizeof(bi)); + CLEAR_FIELD(bi); line_ptr.ul_len = 0; line_ptr.ul_line = NULL; |