From: naddy Date: Wed, 26 Apr 2017 21:25:43 +0000 (+0000) Subject: silence clang warnings: add an extra pair of parentheses and stop X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e768d0ed36fd8b7e974e44a0ea4aa88abd179623;p=openbsd silence clang warnings: add an extra pair of parentheses and stop passing empty format strings to printf-family functions; ok millert@ --- diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c index b4cb41f85e9..27ebc0c6852 100644 --- a/bin/ed/glbl.c +++ b/bin/ed/glbl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glbl.c,v 1.18 2016/03/22 17:58:28 mmcc Exp $ */ +/* $OpenBSD: glbl.c,v 1.19 2017/04/26 21:25:43 naddy Exp $ */ /* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */ /* glob.c: This file contains the global command routines for the ed line @@ -67,7 +67,7 @@ build_active_list(int isgcmd) return ERR; if (isbinary) NUL_TO_NEWLINE(s, lp->len); - if (!regexec(pat, s, 0, NULL, 0) == isgcmd && + if ((!regexec(pat, s, 0, NULL, 0)) == isgcmd && set_active_node(lp) < 0) return ERR; } diff --git a/bin/ed/io.c b/bin/ed/io.c index 2a81d2ab1a7..13e2c583b8d 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.19 2016/03/22 17:58:28 mmcc Exp $ */ +/* $OpenBSD: io.c,v 1.20 2017/04/26 21:25:43 naddy Exp $ */ /* $NetBSD: io.c,v 1.2 1995/03/21 09:04:43 cgd Exp $ */ /* io.c: This file contains the i/o routines for the ed line editor */ @@ -63,7 +63,8 @@ read_file(char *fn, int n) seterrmsg("cannot close input file"); return ERR; } - fprintf(stderr, !scripted ? "%d\n" : "", size); + if (!scripted) + fprintf(stderr, "%d\n", size); return current_addr - n; } @@ -164,7 +165,8 @@ write_file(char *fn, char *mode, int n, int m) seterrmsg("cannot close output file"); return ERR; } - fprintf(stderr, !scripted ? "%d\n" : "", size); + if (!scripted) + fprintf(stderr, "%d\n", size); return n ? m - n + 1 : 0; } diff --git a/bin/ed/main.c b/bin/ed/main.c index 33c3550f500..3ddf399eee6 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.59 2017/01/03 20:24:29 tb Exp $ */ +/* $OpenBSD: main.c,v 1.60 2017/04/26 21:25:43 naddy Exp $ */ /* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */ /* main.c: This file contains the main control and user-interface routines @@ -218,9 +218,10 @@ top: fputs("?\n", stderr); seterrmsg("warning: file modified"); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } clearerr(stdin); @@ -252,28 +253,30 @@ top: fputs("?\n", stderr); /* give warning */ seterrmsg("warning: file modified"); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; case FATAL: - if (!interactive) - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); - else - fprintf(stderr, garrulous ? "%s\n" : "", - errmsg); + if (!interactive) { + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); + } else if (garrulous) + fprintf(stderr, "%s\n", errmsg); quit(3); break; default: fputs("?\n", stderr); if (!interactive) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } break;