/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2012 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/*22* standalone mini vmalloc interface23*/2425#ifndef _VMALLOC_H26#define _VMALLOC_H 12728#define vmalloc(v,n) _vm_resize(v,(void*)0,n)29#define vmalign(v,n,a) _vm_resize(v,(void*)0,n)30#define vmclose(v) _vm_close(v)31#define vmfree(v,p)32#define vmnewof(v,o,t,n,x) (t*)_vm_resize(v,(void*)o,sizeof(t)*(n)+(x))33#define vmopen(a,b,c) _vm_open()3435#define VM_CHUNK (32*1024)36#define VM_ALIGN 163738typedef struct Vmchunk_s39{40struct Vmchunk_s* next;41char align[VM_ALIGN - sizeof(struct Vmchunk_s*)];42char data[VM_CHUNK - VM_ALIGN];43} Vmchunk_t;4445typedef struct Vmalloc_s46{47Vmchunk_t base;48Vmchunk_t* current;49char* data;50long size;51long last;52} Vmalloc_t;5354extern Vmalloc_t* Vmregion;5556extern int _vm_close(Vmalloc_t*);57extern Vmalloc_t* _vm_open(void);58extern void* _vm_resize(Vmalloc_t*, void*, unsigned long);5960#endif616263