/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#if defined(_UWIN) && defined(_BLD_ast)2223void _STUB_vmdcheap(){}2425#else2627#include "vmhdr.h"2829/* A discipline to get memory from the heap.30**31** Written by Kiem-Phong Vo, [email protected], 01/16/94.32*/33#if __STD_C34static Void_t* heapmem(Vmalloc_t* vm, Void_t* caddr,35size_t csize, size_t nsize,36Vmdisc_t* disc)37#else38static Void_t* heapmem(vm, caddr, csize, nsize, disc)39Vmalloc_t* vm; /* region doing allocation from */40Void_t* caddr; /* current low address */41size_t csize; /* current size */42size_t nsize; /* new size */43Vmdisc_t* disc; /* discipline structure */44#endif45{46if(csize == 0 && nsize == 0)47return NIL(Void_t*);48else if(csize == 0)49return vmalloc(Vmheap,nsize);50else if(nsize == 0)51return vmfree(Vmheap,caddr) >= 0 ? caddr : NIL(Void_t*);52else return vmresize(Vmheap,caddr,nsize,0);53}5455static Vmdisc_t _Vmdcheap = { heapmem, NIL(Vmexcept_f), 0 };56__DEFINE__(Vmdisc_t*,Vmdcheap,&_Vmdcheap);5758#ifdef NoF59NoF(vmdcheap)60#endif6162#endif636465