Mercurial > vim
comparison src/alloc.c @ 27018:268f6a3511df v8.2.4038
patch 8.2.4038: various code not used when features are disabled
Commit: https://github.com/vim/vim/commit/748b308eebe8d8860888eb27da08333f175d547d
Author: Dominique Pelle <dominique.pelle@gmail.com>
Date: Sat Jan 8 12:41:16 2022 +0000
patch 8.2.4038: various code not used when features are disabled
Problem: Various code not used when features are disabled.
Solution: Add #ifdefs. (Dominique Pell?, closes https://github.com/vim/vim/issues/9491)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Jan 2022 13:45:04 +0100 |
parents | 6ee19c6ae8a2 |
children | eebbcc83fb75 |
comparison
equal
deleted
inserted
replaced
27017:da790d50f73d | 27018:268f6a3511df |
---|---|
149 alloc(size_t size) | 149 alloc(size_t size) |
150 { | 150 { |
151 return lalloc(size, TRUE); | 151 return lalloc(size, TRUE); |
152 } | 152 } |
153 | 153 |
154 #if defined(FEAT_QUICKFIX) || defined(PROTO) | |
154 /* | 155 /* |
155 * alloc() with an ID for alloc_fail(). | 156 * alloc() with an ID for alloc_fail(). |
156 */ | 157 */ |
157 void * | 158 void * |
158 alloc_id(size_t size, alloc_id_T id UNUSED) | 159 alloc_id(size_t size, alloc_id_T id UNUSED) |
161 if (alloc_fail_id == id && alloc_does_fail(size)) | 162 if (alloc_fail_id == id && alloc_does_fail(size)) |
162 return NULL; | 163 return NULL; |
163 #endif | 164 #endif |
164 return lalloc(size, TRUE); | 165 return lalloc(size, TRUE); |
165 } | 166 } |
167 #endif | |
166 | 168 |
167 /* | 169 /* |
168 * Allocate memory and set all bytes to zero. | 170 * Allocate memory and set all bytes to zero. |
169 */ | 171 */ |
170 void * | 172 void * |
176 if (p != NULL) | 178 if (p != NULL) |
177 (void)vim_memset(p, 0, size); | 179 (void)vim_memset(p, 0, size); |
178 return p; | 180 return p; |
179 } | 181 } |
180 | 182 |
183 #if defined(FEAT_SIGNS) || defined(PROTO) | |
181 /* | 184 /* |
182 * Same as alloc_clear() but with allocation id for testing | 185 * Same as alloc_clear() but with allocation id for testing |
183 */ | 186 */ |
184 void * | 187 void * |
185 alloc_clear_id(size_t size, alloc_id_T id UNUSED) | 188 alloc_clear_id(size_t size, alloc_id_T id UNUSED) |
188 if (alloc_fail_id == id && alloc_does_fail(size)) | 191 if (alloc_fail_id == id && alloc_does_fail(size)) |
189 return NULL; | 192 return NULL; |
190 #endif | 193 #endif |
191 return alloc_clear(size); | 194 return alloc_clear(size); |
192 } | 195 } |
196 #endif | |
193 | 197 |
194 /* | 198 /* |
195 * Allocate memory like lalloc() and set all bytes to zero. | 199 * Allocate memory like lalloc() and set all bytes to zero. |
196 */ | 200 */ |
197 void * | 201 void * |
646 for (i = 0; i < gap->ga_len; ++i) | 650 for (i = 0; i < gap->ga_len; ++i) |
647 vim_free(((char_u **)(gap->ga_data))[i]); | 651 vim_free(((char_u **)(gap->ga_data))[i]); |
648 ga_clear(gap); | 652 ga_clear(gap); |
649 } | 653 } |
650 | 654 |
655 #if defined(FEAT_EVAL) || defined(PROTO) | |
651 /* | 656 /* |
652 * Copy a growing array that contains a list of strings. | 657 * Copy a growing array that contains a list of strings. |
653 */ | 658 */ |
654 int | 659 int |
655 ga_copy_strings(garray_T *from, garray_T *to) | 660 ga_copy_strings(garray_T *from, garray_T *to) |
680 ((char_u **)to->ga_data)[i] = copy; | 685 ((char_u **)to->ga_data)[i] = copy; |
681 } | 686 } |
682 to->ga_len = from->ga_len; | 687 to->ga_len = from->ga_len; |
683 return OK; | 688 return OK; |
684 } | 689 } |
690 #endif | |
685 | 691 |
686 /* | 692 /* |
687 * Initialize a growing array. Don't forget to set ga_itemsize and | 693 * Initialize a growing array. Don't forget to set ga_itemsize and |
688 * ga_growsize! Or use ga_init2(). | 694 * ga_growsize! Or use ga_init2(). |
689 */ | 695 */ |