U(size_aau) U(true_size)(void *payload_ptr) { register head_record *head_ptr = PTR_REC_TO_HEAD(payload_ptr); #ifdef HMM_AUDIT_FAIL AUDIT_BLOCK(head_ptr) #endif /* Convert block size from BAUs to AAUs. Subtract head size, leaving ** payload size. */ return( (BLOCK_BAUS(head_ptr) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) - HEAD_AAUS); }
#include "hmm_intrnl.h" void *U(alloc)(U(descriptor) *desc, U(size_aau) n) { #ifdef HMM_AUDIT_FAIL if (desc->avl_tree_root) AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root)) #endif if (desc->last_freed) { #ifdef HMM_AUDIT_FAIL AUDIT_BLOCK(desc->last_freed) #endif U(into_free_collection)(desc, (head_record *)(desc->last_freed)); desc->last_freed = 0; } /* Add space for block header. */ n += HEAD_AAUS; /* Convert n from number of address alignment units to block alignment ** units. */ n = DIV_ROUND_UP(n, HMM_BLOCK_ALIGN_UNIT);
* tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /* This code is in the public domain. ** Version: 1.1 Author: Walt Karas */ #include "hmm_intrnl.h" int U(resize)(U(descriptor) *desc, void *mem, U(size_aau) n) { U(size_aau) i; head_record *next_head_ptr; head_record *head_ptr = PTR_REC_TO_HEAD(mem); /* Flag. */ int next_block_free; /* Convert n from desired block size in AAUs to BAUs. */ n += HEAD_AAUS; n = DIV_ROUND_UP(n, HMM_BLOCK_ALIGN_UNIT); if (n < MIN_BLOCK_BAUS) n = MIN_BLOCK_BAUS; #ifdef HMM_AUDIT_FAIL AUDIT_BLOCK(head_ptr)