Date: Mon, 20 Apr 2015 11:53:06 -0700 From: Eitan Adler <eadler@freebsd.org> To: Bruce Evans <brde@optusnet.com.au> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r281758 - head/bin/ed Message-ID: <CAF6rxgmpszvBxmWwLCUbL_s_68F5jB4ogSogOyLEZ4ZZcO-zag@mail.gmail.com> In-Reply-To: <20150420134409.I855@besplex.bde.org> References: <201504200207.t3K27vFt078041@svn.freebsd.org> <20150420134409.I855@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 19 April 2015 at 21:23, Bruce Evans <brde@optusnet.com.au> wrote: > On Mon, 20 Apr 2015, Eitan Adler wrote: > >> Log: >> ed(1): Fix [-Werror=logical-not-parentheses] >> /usr/src/bin/ed/glbl.c:64:36: error: logical not is only applied >> to >> theleft hand side of comparison [-Werror=logical-not-parentheses] >> >> Obtained from: Dragonfly (1fff89cbaeaa43af720a1f23d9c466b756dd8a58) >> MFC After: 1 month >> >> Modified: >> head/bin/ed/glbl.c >> >> Modified: head/bin/ed/glbl.c >> >> ============================================================================== >> --- head/bin/ed/glbl.c Mon Apr 20 00:24:32 2015 (r281757) >> +++ head/bin/ed/glbl.c Mon Apr 20 02:07:57 2015 (r281758) >> @@ -60,7 +60,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; >> } > > > How can this be right? !(a == b) is an obfuscated way of writing a != b. bah! How does something like the following look? Index: ed.h =================================================================== --- ed.h (revision 281759) +++ ed.h (working copy) @@ -33,6 +33,7 @@ #include <limits.h> #include <regex.h> #include <signal.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -191,7 +192,7 @@ int put_des_char(int, FILE *); void add_line_node(line_t *); int append_lines(long); int apply_subst_template(const char *, regmatch_t *, int, int); -int build_active_list(int); +int build_active_list(bool); int cbc_decode(unsigned char *, FILE *); int cbc_encode(unsigned char *, int, FILE *); int check_addr_range(long, long); Index: glbl.c =================================================================== --- glbl.c (revision 281759) +++ glbl.c (working copy) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); /* build_active_list: add line matching a pattern to the global-active list */ int -build_active_list(int isgcmd) +build_active_list(bool isgcmd) { pattern_t *pat; line_t *lp; @@ -60,7 +60,7 @@ int 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; } -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgmpszvBxmWwLCUbL_s_68F5jB4ogSogOyLEZ4ZZcO-zag>