From owner-cvs-all Mon Jul 30 11:20:29 2001 Delivered-To: cvs-all@freebsd.org Received: from mail.wrs.com (unknown-1-11.windriver.com [147.11.1.11]) by hub.freebsd.org (Postfix) with ESMTP id 05D0637B401; Mon, 30 Jul 2001 11:20:25 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: from laptop.baldwin.cx (john@[147.11.46.217]) by mail.wrs.com (8.9.3/8.9.1) with ESMTP id LAA27836; Mon, 30 Jul 2001 11:20:16 -0700 (PDT) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200107301811.f6UIB1J00180@khavrinen.lcs.mit.edu> Date: Mon, 30 Jul 2001 11:20:17 -0700 (PDT) From: John Baldwin To: Garrett Wollman Subject: RE: cvs commit: src/usr.sbin/newsyslog Makefile newsyslog.c Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org 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 On 30-Jul-01 Garrett Wollman wrote: > < > said: > >> Why not make the 'ul' variable (icky name) a long and use strtol() instead? >> Then you don't need all the (unsigned) casts for all the comparisons. > > It looks like someone cut-and-pasted my canonical `parse an integer > correctly' code into a new function where the results were not used > carefully. It would be an error to use `strtol' to parse a number > which is not supposed to be negative. It bails if the result is < 0 immediately. :) Not to mention, the code in question doesn't check to see if strtoul() failed (it doesnt' check to see what the 't' var points to) which it would do for a negative number, yes? If you want to stick with strtoul() (which is fine) then I think the other vars should be unsigned rather than adding band-aid casts. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message