diff options
author | obrien <obrien@FreeBSD.org> | 2003-01-19 01:16:01 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2003-01-19 01:16:01 +0000 |
commit | 8af24a10fdd1ff689c2d91440dad34dd07112831 (patch) | |
tree | 870c7ff6e57603f6419efe7c8a9eb33c99364ee1 /lib/libc/gen/stringlist.c | |
parent | 4f8d2d71f0038c143c254adf5df01f4885649f3d (diff) | |
download | FreeBSD-src-8af24a10fdd1ff689c2d91440dad34dd07112831.zip FreeBSD-src-8af24a10fdd1ff689c2d91440dad34dd07112831.tar.gz |
Sync with NetBSD -- sl_add() now returns an int.
Diffstat (limited to 'lib/libc/gen/stringlist.c')
-rw-r--r-- | lib/libc/gen/stringlist.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/gen/stringlist.c b/lib/libc/gen/stringlist.c index ed175ea..79e605d 100644 --- a/lib/libc/gen/stringlist.c +++ b/lib/libc/gen/stringlist.c @@ -51,7 +51,9 @@ __FBSDID("$FreeBSD$"); StringList * sl_init() { - StringList *sl = malloc(sizeof(StringList)); + StringList *sl; + + sl = malloc(sizeof(StringList)); if (sl == NULL) _err(1, "stringlist: %m"); @@ -67,7 +69,7 @@ sl_init() /* * sl_add(): Add an item to the string list */ -void +int sl_add(sl, name) StringList *sl; char *name; @@ -76,9 +78,10 @@ sl_add(sl, name) sl->sl_max += _SL_CHUNKSIZE; sl->sl_str = reallocf(sl->sl_str, sl->sl_max * sizeof(char *)); if (sl->sl_str == NULL) - _err(1, "stringlist: %m"); + return (-1); } sl->sl_str[sl->sl_cur++] = name; + return (0); } |