mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Remove OOM checks: mf_alloc_bhdr()
This commit is contained in:
parent
e5e3cbf320
commit
873a137c64
@ -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
|
* just use the number and free the bhdr_T from the free list
|
||||||
*/
|
*/
|
||||||
if (freep->bh_page_count > page_count) {
|
if (freep->bh_page_count > page_count) {
|
||||||
if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL)
|
if (hp == NULL) {
|
||||||
return NULL;
|
hp = mf_alloc_bhdr(mfp, page_count);
|
||||||
|
}
|
||||||
hp->bh_bnum = freep->bh_bnum;
|
hp->bh_bnum = freep->bh_bnum;
|
||||||
freep->bh_bnum += page_count;
|
freep->bh_bnum += page_count;
|
||||||
freep->bh_page_count -= 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);
|
free(freep);
|
||||||
}
|
}
|
||||||
} else { /* get a new number */
|
} else { /* get a new number */
|
||||||
if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL)
|
if (hp == NULL) {
|
||||||
return NULL;
|
hp = mf_alloc_bhdr(mfp, page_count);
|
||||||
|
}
|
||||||
if (negative) {
|
if (negative) {
|
||||||
hp->bh_bnum = mfp->mf_blocknr_min--;
|
hp->bh_bnum = mfp->mf_blocknr_min--;
|
||||||
mfp->mf_neg_count++;
|
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.
|
* If not, allocate a new block.
|
||||||
*/
|
*/
|
||||||
hp = mf_release(mfp, page_count);
|
hp = mf_release(mfp, page_count);
|
||||||
if (hp == NULL && (hp = mf_alloc_bhdr(mfp, page_count)) == NULL)
|
if (hp == NULL) {
|
||||||
return NULL;
|
hp = mf_alloc_bhdr(mfp, page_count);
|
||||||
|
}
|
||||||
|
|
||||||
hp->bh_bnum = nr;
|
hp->bh_bnum = nr;
|
||||||
hp->bh_flags = 0;
|
hp->bh_flags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user