Commit a1feef75 by Richard Kenner

Replace use of __obj_xmalloc and free with objc_malloc and objc_free.

From-SVN: r12765
parent d2ca2ea6
/* Generic single linked list to keep various information /* Generic single linked list to keep various information
Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
Contributed by Kresten Krab Thorup.
Author: Kresten Krab Thorup
This file is part of GNU CC. This file is part of GNU CC.
...@@ -28,8 +27,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -28,8 +27,6 @@ Boston, MA 02111-1307, USA. */
#ifndef __GNU_OBJC_LIST_H #ifndef __GNU_OBJC_LIST_H
#define __GNU_OBJC_LIST_H #define __GNU_OBJC_LIST_H
void * __objc_xrealloc (void *optr, size_t size);
void * __objc_xmalloc (size_t size);
struct objc_list { struct objc_list {
void *head; void *head;
...@@ -43,7 +40,7 @@ list_cons(void* head, struct objc_list* tail) ...@@ -43,7 +40,7 @@ list_cons(void* head, struct objc_list* tail)
{ {
struct objc_list* cell; struct objc_list* cell;
cell = (struct objc_list*)__objc_xmalloc(sizeof(struct objc_list)); cell = (struct objc_list*)objc_malloc(sizeof(struct objc_list));
cell->head = head; cell->head = head;
cell->tail = tail; cell->tail = tail;
return cell; return cell;
...@@ -88,11 +85,11 @@ list_remove_head(struct objc_list** list) ...@@ -88,11 +85,11 @@ list_remove_head(struct objc_list** list)
{ {
struct objc_list* tail = (*list)->tail; /* fetch next */ struct objc_list* tail = (*list)->tail; /* fetch next */
*(*list) = *tail; /* copy next to list head */ *(*list) = *tail; /* copy next to list head */
free(tail); /* free next */ objc_free(tail); /* free next */
} }
else /* only one element in list */ else /* only one element in list */
{ {
free (*list); objc_free(*list);
(*list) = 0; (*list) = 0;
} }
} }
...@@ -144,7 +141,7 @@ list_free(struct objc_list* list) ...@@ -144,7 +141,7 @@ list_free(struct objc_list* list)
if(list) if(list)
{ {
list_free(list->tail); list_free(list->tail);
free(list); objc_free(list);
} }
} }
#endif __GNU_OBJC_LIST_H #endif __GNU_OBJC_LIST_H
...@@ -66,19 +66,19 @@ object_dispose(id object) ...@@ -66,19 +66,19 @@ object_dispose(id object)
if (_objc_object_dispose) if (_objc_object_dispose)
(*_objc_object_dispose)(object); (*_objc_object_dispose)(object);
else else
free(object); objc_free(object);
} }
return nil; return nil;
} }
id __objc_object_alloc(Class class) id __objc_object_alloc(Class class)
{ {
return (id)__objc_xmalloc(class->instance_size); return (id)objc_malloc(class->instance_size);
} }
id __objc_object_dispose(id object) id __objc_object_dispose(id object)
{ {
free(object); objc_free(object);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment