summaryrefslogtreecommitdiff
path: root/libports/create-class.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-03-31 23:06:50 +0000
committerRoland McGrath <roland@gnu.org>2001-03-31 23:06:50 +0000
commit8a97bddd0358698b14cd99a9fe465b6d8f79c48c (patch)
tree5998d77370c7bba91ff7f8d73cdf72d64df92faf /libports/create-class.c
parent401faf3bb898ddb4f7c025a4f9a78386cc381e0b (diff)
2001-03-29 Neal H Walfield <neal@cs.uml.edu>
* create-bucket.c (ports_create_bucket): Include errno.h and stdlib.h. Do not include assert.h. Turn assertions into errors that set errno and return NULL. * create-class.c (ports_create_class): Likewise.
Diffstat (limited to 'libports/create-class.c')
-rw-r--r--libports/create-class.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libports/create-class.c b/libports/create-class.c
index 7db99ca1..12c8add9 100644
--- a/libports/create-class.c
+++ b/libports/create-class.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995,2001 Free Software Foundation, Inc.
Written by Michael I. Bushnell.
This file is part of the GNU Hurd.
@@ -20,7 +20,7 @@
#include "ports.h"
#include <stdlib.h>
-#include <assert.h>
+#include <errno.h>
struct port_class *
ports_create_class (void (*clean_routine)(void *),
@@ -29,7 +29,12 @@ ports_create_class (void (*clean_routine)(void *),
struct port_class *cl;
cl = malloc (sizeof (struct port_class));
- assert (cl);
+ if (! cl)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
cl->clean_routine = clean_routine;
cl->dropweak_routine = dropweak_routine;
cl->flags = 0;