From owner-cvs-all Thu Mar 7 8:23:54 2002 Delivered-To: cvs-all@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 7A04A37B402; Thu, 7 Mar 2002 08:23:44 -0800 (PST) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id g27GNhi92899; Thu, 7 Mar 2002 09:23:43 -0700 (MST) (envelope-from imp@village.org) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id g27GNgL94468; Thu, 7 Mar 2002 09:23:42 -0700 (MST) (envelope-from imp@village.org) Date: Thu, 07 Mar 2002 09:23:20 -0700 (MST) Message-Id: <20020307.092320.109287988.imp@village.org> To: will@csociety.org Cc: obrien@FreeBSD.org, markm@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/rwall rwall.c From: "M. Warner Losh" In-Reply-To: <20020307111707.GK53073@squall.waterspout.com> References: <200203042027.g24KRc978637@freefall.freebsd.org> <20020307030244.B63484@dragon.nuxi.com> <20020307111707.GK53073@squall.waterspout.com> X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <20020307111707.GK53073@squall.waterspout.com> Will Andrews writes: : On Thu, Mar 07, 2002 at 03:02:44AM -0800, David O'Brien wrote: : > - if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+"))) : > + fd = mkstemp(tmpname); : > + fp = fdopen(fd, "r+"); : > + if (fd == -1 || !fp) : > : > Why did you need to do such code restructuring? : : In my opinion, the above change makes the code clearer. The : previous construct obfuscates the logic. But the two constructs are different. In the prior code, if mkstemp returns -1, then fdopen wouldn't be called. In the new code it is. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message