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"
12 struct typemap * memmap;
14 void *ourcalloc(size_t nmemb, size_t size) {
15 void *oc=calloc(nmemb,size);
16 typemapallocate(memmap, oc,size*nmemb);
20 void *ourmalloc(size_t size) {
21 void *oc=malloc(size);
22 typemapallocate(memmap, oc,size);
26 void ourfree(void *ptr) {
27 typemapdeallocate(memmap, ptr);
31 void *ourrealloc(void *ptr, size_t size) {
32 void *orr=realloc(ptr,size);
34 typemapdeallocate(memmap, ptr);
40 typemapdeallocate(memmap, ptr);
41 typemapallocate(memmap, orr,size);
45 void alloc(void *ptr,int size) {
46 typemapallocate(memmap, ptr,size);
49 void dealloc(void *ptr) {
50 typemapdeallocate(memmap, ptr);
53 void initializemmap() {
54 memmap=allocatetypemap();
61 bool assertvalidtype(int ptr, int structure) {
62 return typemapasserttype(memmap, (void *)ptr, structure);
64 bool assertvalidmemory(int ptr, int structure) {
65 return typemapassertvalidmemory(memmap, (void *)ptr, structure);
68 void initializestack(void *high) {
69 initializetypemapstack(memmap, high);