Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games Use err(1, NULL) and warn(NULL) for `out of memory' er...



details:   https://anonhg.NetBSD.org/src/rev/54bc757f1309
branches:  trunk
changeset: 480337:54bc757f1309
user:      jsm <jsm%NetBSD.org@localhost>
date:      Sun Jan 09 17:17:19 2000 +0000

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

diffstat:

 games/adventure/io.c    |  10 +++++-----
 games/adventure/vocab.c |   6 +++---
 games/battlestar/save.c |  10 +++++-----
 games/caesar/caesar.c   |   6 +++---
 games/monop/monop.c     |   8 ++++----
 games/worm/worm.c       |  10 +++++-----
 6 files changed, 25 insertions(+), 25 deletions(-)

diffs (225 lines):

diff -r 056a61a0adfc -r 54bc757f1309 games/adventure/io.c
--- a/games/adventure/io.c      Sun Jan 09 17:10:43 2000 +0000
+++ b/games/adventure/io.c      Sun Jan 09 17:17:19 2000 +0000
@@ -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 @@
                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 @@
                        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 @@
 
        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;
 
diff -r 056a61a0adfc -r 54bc757f1309 games/adventure/vocab.c
--- a/games/adventure/vocab.c   Sun Jan 09 17:10:43 2000 +0000
+++ b/games/adventure/vocab.c   Sun Jan 09 17:17:19 2000 +0000
@@ -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 @@
                        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 ^ '=';
diff -r 056a61a0adfc -r 54bc757f1309 games/battlestar/save.c
--- a/games/battlestar/save.c   Sun Jan 09 17:10:43 2000 +0000
+++ b/games/battlestar/save.c   Sun Jan 09 17:17:19 2000 +0000
@@ -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 @@
        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 @@
                        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 @@
                } else {
                        newname = malloc(len + 1);
                        if (newname == NULL) {
-                               warnx("out of memory");
+                               warn(NULL);
                                return NULL;
                        }
                        memcpy(newname, filename, len);
diff -r 056a61a0adfc -r 54bc757f1309 games/caesar/caesar.c
--- a/games/caesar/caesar.c     Sun Jan 09 17:10:43 2000 +0000
+++ b/games/caesar/caesar.c     Sun Jan 09 17:17:19 2000 +0000
@@ -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 @@
 #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 @@
                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)
diff -r 056a61a0adfc -r 54bc757f1309 games/monop/monop.c
--- a/games/monop/monop.c       Sun Jan 09 17:10:43 2000 +0000
+++ b/games/monop/monop.c       Sun Jan 09 17:17:19 2000 +0000
@@ -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 @@
 #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 @@
        }
        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 @@
                *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;
        }
diff -r 056a61a0adfc -r 54bc757f1309 games/worm/worm.c
--- a/games/worm/worm.c Sun Jan 09 17:10:43 2000 +0000
+++ b/games/worm/worm.c Sun Jan 09 17:17:19 2000 +0000
@@ -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 @@
 #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 @@
        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 @@
        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 @@
        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;



Home | Main Index | Thread Index | Old Index