From dd31685baaeeabf86d840ca1d26e6ab2d63da2e3 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 25 Apr 2021 20:14:29 +0000 Subject: cgram: conform to lint's strict bool mode, KNF --- cgram/cgram.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cgram') diff --git a/cgram/cgram.c b/cgram/cgram.c index 1708afb9..77c56a54 100644 --- a/cgram/cgram.c +++ b/cgram/cgram.c @@ -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 #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 @@ -216,7 +216,9 @@ char_at_cursor(void) 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 @@ readfile(const char *name) getquote(f); if (fclose(f) != 0) - exit(1); + err(1, "%s", name); } @@ -558,7 +560,7 @@ init(const char *filename) stringarray_init(&lines); stringarray_init(&sollines); srandom((unsigned int)time(NULL)); - if (filename) { + if (filename != NULL) { readfile(filename); } else { readquote(); -- cgit v1.2.3-56-ge451