1 /* Defines interfaces for the applications and exports function calls that
2 the applications should use instead of the standard ones. */
7 #include "instrument.h"
15 void *ourcalloc(size_t nmemb, size_t size) {
16 void *oc=calloc(nmemb,size);
17 memmap->allocate(oc,size*nmemb);
21 void *ourmalloc(size_t size) {
22 void *oc=malloc(size);
23 memmap->allocate(oc,size);
27 void ourfree(void *ptr) {
28 memmap->deallocate(ptr);
32 void *ourrealloc(void *ptr, size_t size) {
33 void *orr=realloc(ptr,size);
35 memmap->deallocate(ptr);
41 memmap->deallocate(ptr);
42 memmap->allocate(ptr,size);
45 void alloc(void *ptr,int size) {
46 memmap->allocate(ptr,size);
49 void dealloc(void *ptr) {
50 memmap->deallocate(ptr);
53 void initializemmap() {
54 typeobject *to=new typeobject();
55 memmap=new typemap(to);
58 typeobject * gettypeobject() {
66 bool assertvalidtype(int ptr, int structure) {
67 return memmap->asserttype((void *)ptr, structure);
69 bool assertvalidmemory(int ptr, int structure) {
70 return memmap->assertvalidmemory((void *)ptr, structure);
73 void initializestack(void *high) {
74 memmap->initializestack(high);