summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2001-02-17 20:15:01 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2001-02-17 20:15:01 +0000
commit541cb262e526b7415bb94badb53deeb08c633a4d (patch)
treef6a17c348e5c639103f64dd9f3ec509de629fbc0
parent5dc1778f37a1d6d773ec2209a474d8487b973125 (diff)
Use err() rather than errx() immediately after alloc failure.
-rw-r--r--games/adventure/io.c10
-rw-r--r--games/adventure/vocab.c6
-rw-r--r--games/caesar/caesar.c6
-rw-r--r--games/sail/pl_main.c6
4 files changed, 14 insertions, 14 deletions
diff --git a/games/adventure/io.c b/games/adventure/io.c
index 849e1f061e4..c397d682506 100644
--- a/games/adventure/io.c
+++ b/games/adventure/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $ */
+/* $OpenBSD: io.c,v 1.8 2001/02/17 20:14:57 pjanzen Exp $ */
/* $NetBSD: io.c,v 1.3 1995/04/24 12:21:37 cgd Exp $ */
/*-
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: io.c,v 1.7 1998/11/29 19:45:10 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: io.c,v 1.8 2001/02/17 20:14:57 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -389,7 +389,7 @@ rtrav() /* read travel table */
if (locc != oldloc) { /* getting a new entry */
t = travel[locc] = (struct travlist *) malloc(sizeof (struct travlist));
if (t == NULL)
- errx(1, "Out of memory!");
+ err(1, NULL);
/* printf("New travel list for %d\n", locc); */
entries = 0;
oldloc = locc;
@@ -412,7 +412,7 @@ rtrav() /* read travel table */
if (entries++) {
t = t->next = (struct travlist *) malloc(sizeof (struct travlist));
if (t == NULL)
- errx(1, "Out of memory!");
+ err(1, NULL);
}
t->tverb = rnum();/* get verb from the file */
t->tloc = n; /* table entry mod 1000 */
@@ -588,7 +588,7 @@ pspeak(m, skip) /* read, decrypt an print a ptext message */
msg = &ptext[m];
if ((tbuf = (char *) malloc(msg->txtlen + 1)) == 0)
- errx(1, "Out of memory!");
+ err(1, NULL);
memcpy(tbuf, msg->seekadr, msg->txtlen + 1); /* Room to null */
s = tbuf;
diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c
index bc9a16d8e74..eddf8d2669e 100644
--- a/games/adventure/vocab.c
+++ b/games/adventure/vocab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vocab.c,v 1.8 2001/02/04 06:07:20 pjanzen Exp $ */
+/* $OpenBSD: vocab.c,v 1.9 2001/02/17 20:14:57 pjanzen Exp $ */
/* $NetBSD: vocab.c,v 1.2 1995/03/21 12:05:13 cgd Exp $ */
/*-
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: vocab.c,v 1.8 2001/02/04 06:07:20 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: vocab.c,v 1.9 2001/02/17 20:14:57 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -167,7 +167,7 @@ vocab(word, type, value) /* look up or store a word */
goto exitloop2;
h->val = value;
if ((h->atab = malloc(length(word))) == NULL)
- errx(1, "Out of memory!");
+ err(1, NULL);
for (s = word, t = h->atab; *s;)
*t++ = *s++ ^ '=';
*t = 0 ^ '=';
diff --git a/games/caesar/caesar.c b/games/caesar/caesar.c
index 9cd63673cb9..a02b8e099c4 100644
--- a/games/caesar/caesar.c
+++ b/games/caesar/caesar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: caesar.c,v 1.7 1998/08/19 07:53:54 pjanzen Exp $ */
+/* $OpenBSD: caesar.c,v 1.8 2001/02/17 20:15:00 pjanzen Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -51,7 +51,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: caesar.c,v 1.7 1998/08/19 07:53:54 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: caesar.c,v 1.8 2001/02/17 20:15:00 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -112,7 +112,7 @@ main(argc, argv)
}
if (!(inbuf = malloc(LINELENGTH)))
- errx(1, "out of memory.");
+ err(1, NULL);
/* adjust frequency table to weight low probs REAL low */
for (i = 0; i < 26; ++i)
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c
index 63f2b8fc63d..22ff6e9cf45 100644
--- a/games/sail/pl_main.c
+++ b/games/sail/pl_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pl_main.c,v 1.6 1999/06/13 16:43:12 pjanzen Exp $ */
+/* $OpenBSD: pl_main.c,v 1.7 2001/02/17 20:15:00 pjanzen Exp $ */
/* $NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: pl_main.c,v 1.6 1999/06/13 16:43:12 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: pl_main.c,v 1.7 2001/02/17 20:15:00 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -97,7 +97,7 @@ reprint:
foreachship(sp) {
if (sp->file == NULL &&
(sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL)
- errx(1, "out of memory");
+ err(1, NULL);
sp->file->index = sp - SHIP(0);
sp->file->stern = nat[sp->nationality]++;
sp->file->dir = sp->shipdir;