From 186824a96777e9998fbb82c58e8e0ad848a9353a Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Tue, 22 Apr 2003 06:35:44 +0000 Subject: Complete the space allocation code for HBIN blocks ... (This used to be commit ae5f8e4b5f7b8880293cc94c9bbe0df81a56959e) --- source3/utils/editreg.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'source3/utils') diff --git a/source3/utils/editreg.c b/source3/utils/editreg.c index 0229395176..bdfb3dc832 100644 --- a/source3/utils/editreg.c +++ b/source3/utils/editreg.c @@ -2522,15 +2522,39 @@ void *nt_alloc_regf_space(REGF *regf, int size, int *off) /* * Fix up the free space ptr + * If it is NULL, we fix it up next time */ - } + if (!blk->free_space) + regf->free_space = blk->next; + + *off = tmp; + return ret; + } } /* * If we got here, we need to add another block, which might be * larger than one block -- deal with that later */ + if (nt_create_hbin_blk(regf, REGF_HDR_BLKSIZ)) { + blk = regf->free_space; + tmp = blk->file_offset + blk->fsp_off; + ret = blk->data + blk->fsp_off; + blk->free_space -= size; + blk->fsp_off += size; + + /* + * Fix up the free space ptr + * If it is NULL, we fix it up next time + */ + + if (!blk->free_space) + regf->free_space = blk->next; + + *off = tmp; + return ret; + } return NULL; } -- cgit