Example #1
0
void smAllocateBlock(Structure_Manager *pSM) {

  void *pNewBlock;

  dbg_smPrint(LOG_STRUCT_MANAGER, *pSM,"before block allocation");
  pNewBlock = malloc(SM_NewBlockSize(*pSM));
  if ( IsNULL(pNewBlock) )
    xsb_abort("[smAllocateBlock] Out of memory in allocation of %s block\n",
	      SM_StructName(*pSM));
  SMBlk_NextBlock(pNewBlock) = SM_CurBlock(*pSM);
  SM_CurBlock(*pSM) = pNewBlock;
  SM_NextStruct(*pSM) = SMBlk_FirstStruct(pNewBlock);
  SM_LastStruct(*pSM) = SMBlk_LastStruct(pNewBlock,
					 SM_StructSize(*pSM),
					 SM_StructsPerBlock(*pSM));
  dbg_smPrint(LOG_STRUCT_MANAGER, *pSM,"after block allocation");
}
Example #2
0
void smAllocateBlock(Structure_Manager *pSM) {

  void *pNewBlock;

  pNewBlock = mem_calloc(SM_NewBlockSize(*pSM),1,TABLE_SPACE);  
  //  if ( IsNULL(pNewBlock) )
  //    xsb_resource_error_nopred("memory","[smAllocateBlock] Out of memory in allocation of %s block\n",
  //			      SM_StructName(*pSM));
  SMBlk_NextBlock(pNewBlock) = SM_CurBlock(*pSM);
  SM_CurBlock(*pSM) = pNewBlock;
  SM_NextStruct(*pSM) = SMBlk_FirstStruct(pNewBlock);
  SM_LastStruct(*pSM) = SMBlk_LastStruct(pNewBlock,
					 SM_StructSize(*pSM),
					 SM_StructsPerBlock(*pSM));
  dbg_smPrint(LOG_STRUCT_MANAGER, *pSM,"after block allocation");
}