diff options
| author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-10 00:39:08 -0300 | 
|---|---|---|
| committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-19 14:50:23 -0300 | 
| commit | 873a137c64c032cb74c6a8d444efb413703afbe0 (patch) | |
| tree | 77c4e82902f1b76771bc5e6a30f791f164215414 /src | |
| parent | e5e3cbf320659f56ad48ded5077a4a91ad23a6cc (diff) | |
| download | rneovim-873a137c64c032cb74c6a8d444efb413703afbe0.tar.gz rneovim-873a137c64c032cb74c6a8d444efb413703afbe0.tar.bz2 rneovim-873a137c64c032cb74c6a8d444efb413703afbe0.zip | |
Remove OOM checks: mf_alloc_bhdr()
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/memfile.c | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 5ba7ee771b..6418b99c68 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -315,8 +315,9 @@ bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count)       * just use the number and free the bhdr_T from the free list       */      if (freep->bh_page_count > page_count) { -      if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL) -        return NULL; +      if (hp == NULL) { +        hp = mf_alloc_bhdr(mfp, page_count); +      }        hp->bh_bnum = freep->bh_bnum;        freep->bh_bnum += page_count;        freep->bh_page_count -= page_count; @@ -330,8 +331,9 @@ bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count)        free(freep);      }    } else {    /* get a new number */ -    if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL) -      return NULL; +    if (hp == NULL) { +      hp = mf_alloc_bhdr(mfp, page_count); +    }      if (negative) {        hp->bh_bnum = mfp->mf_blocknr_min--;        mfp->mf_neg_count++; @@ -384,8 +386,9 @@ bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, int page_count)       * If not, allocate a new block.       */      hp = mf_release(mfp, page_count); -    if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL) -      return NULL; +    if (hp == NULL) { +      hp = mf_alloc_bhdr(mfp, page_count); +    }      hp->bh_bnum = nr;      hp->bh_flags = 0; | 
