mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.1507: using malloc() directly
Problem: Using malloc() directly.
Solution: Use ALLOC_ONE(). Remove superfluous typecast. (Hussam al-Homsi,
closes vim/vim#6768)
51b6eb47b3
This commit is contained in:
parent
f7f7146588
commit
effd234960
@ -5280,15 +5280,11 @@ bool set_ref_in_item(typval_T *tv, int copyID, ht_stack_T **ht_stack,
|
||||
if (ht_stack == NULL) {
|
||||
abort = set_ref_in_ht(&dd->dv_hashtab, copyID, list_stack);
|
||||
} else {
|
||||
ht_stack_T *newitem = try_malloc(sizeof(ht_stack_T));
|
||||
if (newitem == NULL) {
|
||||
abort = true;
|
||||
} else {
|
||||
ht_stack_T *const newitem = xmalloc(sizeof(ht_stack_T));
|
||||
newitem->ht = &dd->dv_hashtab;
|
||||
newitem->prev = *ht_stack;
|
||||
*ht_stack = newitem;
|
||||
}
|
||||
}
|
||||
|
||||
QUEUE *w = NULL;
|
||||
DictWatcher *watcher = NULL;
|
||||
@ -5308,16 +5304,12 @@ bool set_ref_in_item(typval_T *tv, int copyID, ht_stack_T **ht_stack,
|
||||
if (list_stack == NULL) {
|
||||
abort = set_ref_in_list(ll, copyID, ht_stack);
|
||||
} else {
|
||||
list_stack_T *newitem = try_malloc(sizeof(list_stack_T));
|
||||
if (newitem == NULL) {
|
||||
abort = true;
|
||||
} else {
|
||||
list_stack_T *const newitem = xmalloc(sizeof(list_stack_T));
|
||||
newitem->list = ll;
|
||||
newitem->prev = *list_stack;
|
||||
*list_stack = newitem;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3859,8 +3859,8 @@ static void ml_updatechunk(buf_T *buf, linenr_T line, long len, int updtype)
|
||||
/* May resize here so we don't have to do it in both cases below */
|
||||
if (buf->b_ml.ml_usedchunks + 1 >= buf->b_ml.ml_numchunks) {
|
||||
buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
|
||||
buf->b_ml.ml_chunksize = (chunksize_T *)
|
||||
xrealloc(buf->b_ml.ml_chunksize,
|
||||
buf->b_ml.ml_chunksize = xrealloc(
|
||||
buf->b_ml.ml_chunksize,
|
||||
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user