diff options
author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-12 01:44:58 +0000 |
---|---|---|
committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-12 01:44:58 +0000 |
commit | bb882a434a451b097294fda228a464f458d2e6ad (patch) | |
tree | d3064b97c59138cbba1ca85249d30ede27b9aacf /libobjc/objc | |
parent | c3a945cde92094f4713cefdafe5c1bd3f07fbbcc (diff) | |
download | gcc-bb882a434a451b097294fda228a464f458d2e6ad.tar.gz |
In libobjc/:
* objc/deprecated/objc_malloc.h: New file.
* objc/deprecated/objc_valloc.h: New file.
* objc/objc-api.h: Include the files instead of defining
objc_valloc, _objc_malloc() and similar.
* Makefile.in (OBJC_DEPRECATED_H): Added objc_valloc.h and
objc_malloc.h.
* memory.c: Removed the extra layer of indirection of _objc_malloc
and similar.
(objc_calloc): Use GC_malloc in the garbage-collected
implementation as GC_malloc returns memory that is already freed.
(objc_valloc): Deprecated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164224 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc/objc')
-rw-r--r-- | libobjc/objc/deprecated/objc_malloc.h | 17 | ||||
-rw-r--r-- | libobjc/objc/deprecated/objc_valloc.h | 2 | ||||
-rw-r--r-- | libobjc/objc/objc-api.h | 33 |
3 files changed, 27 insertions, 25 deletions
diff --git a/libobjc/objc/deprecated/objc_malloc.h b/libobjc/objc/deprecated/objc_malloc.h new file mode 100644 index 00000000000..cf6c6e9d092 --- /dev/null +++ b/libobjc/objc/deprecated/objc_malloc.h @@ -0,0 +1,17 @@ +/* +** Hook functions for memory allocation and disposal. +** This makes it easy to substitute garbage collection systems +** such as Boehm's GC by assigning these function pointers +** to the GC's allocation routines. By default these point +** to the ANSI standard malloc, realloc, free, etc. +** +** Users should call the normal objc routines above for +** memory allocation and disposal within their programs. +*/ +objc_EXPORT void *(*_objc_malloc)(size_t); +objc_EXPORT void *(*_objc_atomic_malloc)(size_t); +objc_EXPORT void *(*_objc_valloc)(size_t); +objc_EXPORT void *(*_objc_realloc)(void *, size_t); +objc_EXPORT void *(*_objc_calloc)(size_t, size_t); +objc_EXPORT void (*_objc_free)(void *); + diff --git a/libobjc/objc/deprecated/objc_valloc.h b/libobjc/objc/deprecated/objc_valloc.h new file mode 100644 index 00000000000..a715f1a7330 --- /dev/null +++ b/libobjc/objc/deprecated/objc_valloc.h @@ -0,0 +1,2 @@ +void * +objc_valloc(size_t size); diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h index 89c5fcd9f3b..9fff9e1d155 100644 --- a/libobjc/objc/objc-api.h +++ b/libobjc/objc/objc-api.h @@ -82,10 +82,8 @@ struct objc_method_description #define _C_VECTOR '!' #define _C_COMPLEX 'j' - #include "deprecated/objc_error.h" - /* For every class which happens to have statically allocated instances in this module, one OBJC_STATIC_INSTANCES is allocated by the compiler. INSTANCES is NULL terminated and points to all statically allocated @@ -328,21 +326,20 @@ objc_EXPORT id (*_objc_object_copy)(id object); objc_EXPORT id (*_objc_object_dispose)(id object); /* -** Standard functions for memory allocation and disposal. -** Users should use these functions in their ObjC programs so -** that they work properly with garbage collectors as well as -** can take advantage of the exception/error handling available. + Standard functions for memory allocation and disposal. Users should + use these functions in their ObjC programs so that they work so that + they work properly with garbage collectors. */ void * objc_malloc(size_t size); +/* FIXME: Shouldn't the following be called objc_malloc_atomic ? The + GC function is GC_malloc_atomic() which makes sense. + */ void * objc_atomic_malloc(size_t size); void * -objc_valloc(size_t size); - -void * objc_realloc(void *mem, size_t size); void * @@ -351,22 +348,8 @@ objc_calloc(size_t nelem, size_t size); void objc_free(void *mem); -/* -** Hook functions for memory allocation and disposal. -** This makes it easy to substitute garbage collection systems -** such as Boehm's GC by assigning these function pointers -** to the GC's allocation routines. By default these point -** to the ANSI standard malloc, realloc, free, etc. -** -** Users should call the normal objc routines above for -** memory allocation and disposal within their programs. -*/ -objc_EXPORT void *(*_objc_malloc)(size_t); -objc_EXPORT void *(*_objc_atomic_malloc)(size_t); -objc_EXPORT void *(*_objc_valloc)(size_t); -objc_EXPORT void *(*_objc_realloc)(void *, size_t); -objc_EXPORT void *(*_objc_calloc)(size_t, size_t); -objc_EXPORT void (*_objc_free)(void *); +#include "deprecated/objc_valloc.h" +#include "deprecated/objc_malloc.h" /* ** Hooks for method forwarding. This makes it easy to substitute a |