* ext/thread/thread.c: Use xmalloc()/xfree() instead of

malloc()/free(); pointed out by shugo in [ruby-dev:30412].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2007-02-26 06:22:08 +00:00
parent d76ebe83df
commit e529cb40d0
2 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,8 @@
Mon Feb 26 15:18:23 2007 Akinori MUSHA <knu@iDaemons.org>
* ext/thread/thread.c: Use xmalloc()/xfree() instead of
malloc()/free(); pointed out by shugo in [ruby-dev:30412].
Sun Feb 25 23:02:55 2007 Akinori MUSHA <knu@iDaemons.org> Sun Feb 25 23:02:55 2007 Akinori MUSHA <knu@iDaemons.org>
* lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::initialize): * lib/test/unit/autorunner.rb (Test::Unit::AutoRunner::initialize):

View file

@ -86,7 +86,7 @@ free_entries(Entry *first)
Entry *next; Entry *next;
while (first) { while (first) {
next = first->next; next = first->next;
free(first); xfree(first);
first = next; first = next;
} }
} }
@ -107,7 +107,7 @@ push_list(List *list, VALUE value)
entry = list->entry_pool; entry = list->entry_pool;
list->entry_pool = entry->next; list->entry_pool = entry->next;
} else { } else {
entry = (Entry *)malloc(sizeof(Entry)); entry = (Entry *)xmalloc(sizeof(Entry));
} }
entry->value = value; entry->value = value;
@ -325,7 +325,7 @@ free_mutex(Mutex *mutex)
{ {
assert_no_survivors(&mutex->waiting, "mutex", mutex); assert_no_survivors(&mutex->waiting, "mutex", mutex);
finalize_mutex(mutex); finalize_mutex(mutex);
free(mutex); xfree(mutex);
} }
static void static void
@ -347,7 +347,7 @@ static VALUE
rb_mutex_alloc(VALUE klass) rb_mutex_alloc(VALUE klass)
{ {
Mutex *mutex; Mutex *mutex;
mutex = (Mutex *)malloc(sizeof(Mutex)); mutex = (Mutex *)xmalloc(sizeof(Mutex));
init_mutex(mutex); init_mutex(mutex);
return Data_Wrap_Struct(klass, mark_mutex, free_mutex, mutex); return Data_Wrap_Struct(klass, mark_mutex, free_mutex, mutex);
} }
@ -598,7 +598,7 @@ free_condvar(ConditionVariable *condvar)
{ {
assert_no_survivors(&condvar->waiting, "condition variable", condvar); assert_no_survivors(&condvar->waiting, "condition variable", condvar);
finalize_condvar(condvar); finalize_condvar(condvar);
free(condvar); xfree(condvar);
} }
static void static void
@ -620,7 +620,7 @@ rb_condvar_alloc(VALUE klass)
{ {
ConditionVariable *condvar; ConditionVariable *condvar;
condvar = (ConditionVariable *)malloc(sizeof(ConditionVariable)); condvar = (ConditionVariable *)xmalloc(sizeof(ConditionVariable));
init_condvar(condvar); init_condvar(condvar);
return Data_Wrap_Struct(klass, mark_condvar, free_condvar, condvar); return Data_Wrap_Struct(klass, mark_condvar, free_condvar, condvar);
@ -806,7 +806,7 @@ free_queue(Queue *queue)
assert_no_survivors(&queue->space_available.waiting, "queue", queue); assert_no_survivors(&queue->space_available.waiting, "queue", queue);
assert_no_survivors(&queue->value_available.waiting, "queue", queue); assert_no_survivors(&queue->value_available.waiting, "queue", queue);
finalize_queue(queue); finalize_queue(queue);
free(queue); xfree(queue);
} }
static void static void
@ -831,7 +831,7 @@ static VALUE
rb_queue_alloc(VALUE klass) rb_queue_alloc(VALUE klass)
{ {
Queue *queue; Queue *queue;
queue = (Queue *)malloc(sizeof(Queue)); queue = (Queue *)xmalloc(sizeof(Queue));
init_queue(queue); init_queue(queue);
return Data_Wrap_Struct(klass, mark_queue, free_queue, queue); return Data_Wrap_Struct(klass, mark_queue, free_queue, queue);
} }