Use err(1, NULL) and warn(NULL) for `out of memory' error messages.

This commit is contained in:
jsm 2000-01-09 17:17:19 +00:00
parent 35957910a6
commit a5da40c55a
6 changed files with 25 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.11 1999/02/10 00:11:28 hubertf Exp $ */
/* $NetBSD: io.c,v 1.12 2000/01/09 17:17:19 jsm Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: io.c,v 1.11 1999/02/10 00:11:28 hubertf Exp $");
__RCSID("$NetBSD: io.c,v 1.12 2000/01/09 17:17:19 jsm Exp $");
#endif
#endif /* not lint */
@ -361,7 +361,7 @@ rtrav()
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;
@ -384,7 +384,7 @@ rtrav()
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 */
@ -559,7 +559,7 @@ pspeak(m, skip) /* read, decrypt an print a ptext message */
msg = &ptext[m];
if ((tbuf = (char *) malloc(msg->txtlen + 1)) == NULL)
errx(1, "Out of memory!");
err(1, NULL);
memcpy(tbuf, msg->seekadr, msg->txtlen + 1); /* Room to null */
s = tbuf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $ */
/* $NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $");
__RCSID("$NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $");
#endif
#endif /* not lint */
@ -165,7 +165,7 @@ vocab(word, type, value) /* look up or store a word */
h->val = value;
h->atab = malloc(length(word));
if (h->atab == NULL)
errx(1, "Out of memory!");
err(1, NULL);
for (s = word, t = h->atab; *s;)
*t++ = *s++ ^ '=';
*t = 0 ^ '=';

View File

@ -1,4 +1,4 @@
/* $NetBSD: save.c,v 1.9 1999/07/28 01:45:43 hubertf Exp $ */
/* $NetBSD: save.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)save.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: save.c,v 1.9 1999/07/28 01:45:43 hubertf Exp $");
__RCSID("$NetBSD: save.c,v 1.10 2000/01/09 17:17:20 jsm Exp $");
#endif
#endif /* not lint */
@ -171,7 +171,7 @@ save_file_name(filename, len)
if (memchr(filename, '/', len)) {
newname = malloc(len + 1);
if (newname == NULL) {
warnx("out of memory");
warn(NULL);
return NULL;
}
memcpy(newname, filename, len);
@ -182,7 +182,7 @@ save_file_name(filename, len)
tmpl = strlen(home);
newname = malloc(tmpl + len + 2);
if (newname == NULL) {
warnx("out of memory");
warn(NULL);
return NULL;
}
memcpy(newname, home, tmpl);
@ -192,7 +192,7 @@ save_file_name(filename, len)
} else {
newname = malloc(len + 1);
if (newname == NULL) {
warnx("out of memory");
warn(NULL);
return NULL;
}
memcpy(newname, filename, len);

View File

@ -1,4 +1,4 @@
/* $NetBSD: caesar.c,v 1.9 1999/09/08 21:17:46 jsm Exp $ */
/* $NetBSD: caesar.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */
/*
* Copyright (c) 1989, 1993
@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: caesar.c,v 1.9 1999/09/08 21:17:46 jsm Exp $");
__RCSID("$NetBSD: caesar.c,v 1.10 2000/01/09 17:17:20 jsm Exp $");
#endif
#endif /* not lint */
@ -100,7 +100,7 @@ main(argc, argv)
printit(argv[1]);
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)

View File

@ -1,4 +1,4 @@
/* $NetBSD: monop.c,v 1.9 1999/09/12 09:02:22 jsm Exp $ */
/* $NetBSD: monop.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: monop.c,v 1.9 1999/09/12 09:02:22 jsm Exp $");
__RCSID("$NetBSD: monop.c,v 1.10 2000/01/09 17:17:20 jsm Exp $");
#endif
#endif /* not lint */
@ -120,7 +120,7 @@ blew_it:
}
cur_p = play = (PLAY *) calloc(num_play, sizeof (PLAY));
if (play == NULL)
errx(1, "out of memory");
err(1, NULL);
for (i = 0; i < num_play; i++) {
over:
printf("Player %d's name: ", i + 1);
@ -131,7 +131,7 @@ over:
*sp++ = '\0';
name_list[i] = play[i].name = (char *)calloc(1, sp - buf);
if (name_list[i] == NULL)
errx(1, "out of memory");
err(1, NULL);
strcpy(play[i].name, buf);
play[i].money = 1500;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: worm.c,v 1.17 1999/10/26 06:35:49 cgd Exp $ */
/* $NetBSD: worm.c,v 1.18 2000/01/09 17:17:21 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)worm.c 8.1 (Berkeley) 5/31/93";
#else
__RCSID("$NetBSD: worm.c,v 1.17 1999/10/26 06:35:49 cgd Exp $");
__RCSID("$NetBSD: worm.c,v 1.18 2000/01/09 17:17:21 jsm Exp $");
#endif
#endif /* not lint */
@ -157,7 +157,7 @@ life()
np = NULL;
head = newlink();
if (head == NULL)
errx(1, "out of memory");
err(1, NULL);
head->x = start_len+2;
head->y = 12;
head->next = NULL;
@ -165,7 +165,7 @@ life()
for (i = 0, bp = head; i < start_len; i++, bp = np) {
np = newlink();
if (np == NULL)
errx(1, "out of memory");
err(1, NULL);
np->next = bp;
bp->prev = np;
np->x = bp->x - 1;
@ -312,7 +312,7 @@ process(ch)
else if(ch != ' ') crash();
nh = newlink();
if (nh == NULL)
errx(1, "out of memory");
err(1, NULL);
nh->next = NULL;
nh->prev = head;
head->next = nh;