aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/hashtab.c
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-09 03:30:26 -0300
committerFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-19 14:50:23 -0300
commit21784aeb005e78f04f4c1d398bc486be0a65248e (patch)
tree5180a6de4bd033571e351d06b04419a3af768198 /src/nvim/hashtab.c
parenta80d7e86c1f088c5b68d8e8929cc72a0d9680f76 (diff)
downloadrneovim-21784aeb005e78f04f4c1d398bc486be0a65248e.tar.gz
rneovim-21784aeb005e78f04f4c1d398bc486be0a65248e.tar.bz2
rneovim-21784aeb005e78f04f4c1d398bc486be0a65248e.zip
Replace alloc() with xmalloc() and remove immediate OOM checks
Diffstat (limited to 'src/nvim/hashtab.c')
-rw-r--r--src/nvim/hashtab.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index 4918a0226f..7445a4cec1 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -347,18 +347,7 @@ static int hash_may_resize(hashtab_T *ht, int minitems)
}
} else {
// Allocate an array.
- newarray = (hashitem_T *)alloc((unsigned)(sizeof(hashitem_T) * newsize));
-
- if (newarray == NULL) {
- // Out of memory. When there are NULL items still return OK.
- // Otherwise set ht_error, because lookup may result in a hang if
- // we add another item.
- if (ht->ht_filled < ht->ht_mask) {
- return OK;
- }
- ht->ht_error = TRUE;
- return FAIL;
- }
+ newarray = xmalloc(sizeof(hashitem_T) * newsize);
oldarray = ht->ht_array;
}
memset(newarray, 0, (size_t)(sizeof(hashitem_T) * newsize));