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/if_mzsch.c | |
parent | 82de464f763d6e6d89229be03ce7c6d02fd5fb59 (diff) |
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/if_mzsch.c')
-rw-r--r-- | src/if_mzsch.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 0ee922daa7..8cc2e21454 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -1927,7 +1927,7 @@ window_new(win_T *win) MZ_GC_REG(); self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_window)); - vim_memset(self, 0, sizeof(vim_mz_window)); + CLEAR_POINTER(self); #ifndef MZ_PRECISE_GC scheme_dont_gc_ptr(self); // because win isn't visible to GC #else @@ -2311,7 +2311,7 @@ buffer_new(buf_T *buf) MZ_GC_REG(); self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_buffer)); - vim_memset(self, 0, sizeof(vim_mz_buffer)); + CLEAR_POINTER(self); #ifndef MZ_PRECISE_GC scheme_dont_gc_ptr(self); // because buf isn't visible to GC #else @@ -2634,8 +2634,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) MZ_GC_VAR_IN_REG(1, rest); MZ_GC_REG(); - array = ALLOC_MULT(char *, new_len + 1); - vim_memset(array, 0, (new_len+1) * sizeof(char *)); + array = ALLOC_CLEAR_MULT(char *, new_len + 1); rest = line_list; for (i = 0; i < new_len; ++i) @@ -2818,8 +2817,7 @@ insert_buffer_line_list(void *data, int argc, Scheme_Object **argv) MZ_GC_VAR_IN_REG(1, rest); MZ_GC_REG(); - array = ALLOC_MULT(char *, size + 1); - vim_memset(array, 0, (size+1) * sizeof(char *)); + array = ALLOC_CLEAR_MULT(char *, size + 1); rest = list; for (i = 0; i < size; ++i) |