Source-Changes-HG archive

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

[src/trunk]: src/games/cgram cgram: conform to lint's strict bool mode, KNF



details:   https://anonhg.NetBSD.org/src/rev/095861fbee5b
branches:  trunk
changeset: 982754:095861fbee5b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Apr 25 20:14:29 2021 +0000

description:
cgram: conform to lint's strict bool mode, KNF

diffstat:

 games/cgram/cgram.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r c1d95bf1eb2f -r 095861fbee5b games/cgram/cgram.c
--- a/games/cgram/cgram.c       Sun Apr 25 18:44:04 2021 +0000
+++ b/games/cgram/cgram.c       Sun Apr 25 20:14:29 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgram.c,v 1.18 2021/04/22 14:57:36 wiz Exp $ */
+/* $NetBSD: cgram.c,v 1.19 2021/04/25 20:14:29 rillig Exp $ */
 
 /*-
  * Copyright (c) 2013, 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.c,v 1.18 2021/04/22 14:57:36 wiz Exp $");
+__RCSID("$NetBSD: cgram.c,v 1.19 2021/04/25 20:14:29 rillig Exp $");
 #endif
 
 #include <assert.h>
@@ -216,7 +216,9 @@
        return lines.v[cursor_y].s[cursor_x];
 }
 
-static void getquote(FILE *f) {
+static void
+getquote(FILE *f)
+{
        struct string line;
        string_init(&line);
 
@@ -255,7 +257,7 @@
        getquote(f);
 
        if (fclose(f) != 0)
-               exit(1);
+               err(1, "%s", name);
 }
 
 
@@ -558,7 +560,7 @@
        stringarray_init(&lines);
        stringarray_init(&sollines);
        srandom((unsigned int)time(NULL));
-       if (filename) {
+       if (filename != NULL) {
            readfile(filename);
        } else {
            readquote();



Home | Main Index | Thread Index | Old Index