From: bdemsky Date: Fri, 6 Feb 2009 01:54:26 +0000 (+0000) Subject: __attribute__(malloc) magic X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=59e974a0d6084f35bc22c322cf6f95bec34bc474;p=IRC.git __attribute__(malloc) magic --- diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index 52036b4e..43db3b57 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -200,7 +200,7 @@ struct ArrayObject * allocate_newarray(void * ptr, int type, int length) { } #else -void * allocate_new(int type) { +__attribute__(malloc) void * allocate_new(int type) { struct ___Object___ * v=FREEMALLOC(classsize[type]); v->type=type; #ifdef OPTIONAL @@ -211,7 +211,7 @@ void * allocate_new(int type) { /* Array allocation function */ -struct ArrayObject * allocate_newarray(int type, int length) { +__attribute__(malloc) struct ArrayObject * allocate_newarray(int type, int length) { struct ArrayObject * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); v->type=type; v->___length___=length; @@ -227,7 +227,7 @@ struct ArrayObject * allocate_newarray(int type, int length) { #ifdef PRECISE_GC struct ___String___ * NewString(void * ptr, const char *str,int length) { #else -struct ___String___ * NewString(const char *str,int length) { + __attribute__(malloc) struct ___String___ * NewString(const char *str,int length) { #endif int i; #ifdef PRECISE_GC diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index 68692e80..13b5fac5 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -38,9 +38,9 @@ struct ArrayObject * allocate_newarray(void *, int type, int length); struct ___String___ * NewString(void *, const char *str,int length); struct ___TagDescriptor___ * allocate_tag(void *ptr, int index); #else -void * allocate_new(int type); -struct ArrayObject * allocate_newarray(int type, int length); -struct ___String___ * NewString(const char *str,int length); +__attribute__((malloc)) void * allocate_new(int type); +__attribute__((malloc)) struct ArrayObject * allocate_newarray(int type, int length); +__attribute__((malloc)) struct ___String___ * NewString(const char *str,int length); struct ___TagDescriptor___ * allocate_tag(int index); #endif