aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-04-04 16:39:57 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-11 12:57:59 -0300
commit457bb2615154946d273d75e07f5d5a936f50ede0 (patch)
tree3fd42ed18a9e646e7339eedf6bee030161505793
parentb4545740fdc1e694a1e5b45f95bdb7cdf7d292a0 (diff)
downloadrneovim-457bb2615154946d273d75e07f5d5a936f50ede0.tar.gz
rneovim-457bb2615154946d273d75e07f5d5a936f50ede0.tar.bz2
rneovim-457bb2615154946d273d75e07f5d5a936f50ede0.zip
Remove OOM error handling code after calls to mf_hash_grow()
-rw-r--r--src/memfile.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/memfile.c b/src/memfile.c
index cdcdd23484..7a9b062d58 100644
--- a/src/memfile.c
+++ b/src/memfile.c
@@ -91,7 +91,7 @@ static void mf_hash_free_all(mf_hashtab_T *);
static mf_hashitem_T *mf_hash_find(mf_hashtab_T *, blocknr_T);
static void mf_hash_add_item(mf_hashtab_T *, mf_hashitem_T *);
static void mf_hash_rem_item(mf_hashtab_T *, mf_hashitem_T *);
-static int mf_hash_grow(mf_hashtab_T *);
+static void mf_hash_grow(mf_hashtab_T *);
/*
* The functions for using a memfile:
@@ -1226,10 +1226,7 @@ static void mf_hash_add_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
*/
if (mht->mht_fixed == 0
&& (mht->mht_count >> MHT_LOG_LOAD_FACTOR) > mht->mht_mask) {
- if (mf_hash_grow(mht) == FAIL) {
- /* stop trying to grow after first failure to allocate memory */
- mht->mht_fixed = 1;
- }
+ mf_hash_grow(mht);
}
}
@@ -1256,9 +1253,8 @@ static void mf_hash_rem_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
/*
* Increase number of buckets in the hashtable by MHT_GROWTH_FACTOR and
* rehash items.
- * Returns FAIL when out of memory.
*/
-static int mf_hash_grow(mf_hashtab_T *mht)
+static void mf_hash_grow(mf_hashtab_T *mht)
{
long_u i, j;
int shift;
@@ -1269,8 +1265,6 @@ static int mf_hash_grow(mf_hashtab_T *mht)
size = (mht->mht_mask + 1) * MHT_GROWTH_FACTOR * sizeof(void *);
buckets = (mf_hashitem_T **)lalloc_clear(size, FALSE);
- if (buckets == NULL)
- return FAIL;
shift = 0;
while ((mht->mht_mask >> shift) != 0)
@@ -1313,6 +1307,4 @@ static int mf_hash_grow(mf_hashtab_T *mht)
mht->mht_buckets = buckets;
mht->mht_mask = (mht->mht_mask + 1) * MHT_GROWTH_FACTOR - 1;
-
- return OK;
}