Date: Mon, 30 Jul 2001 11:20:17 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: RE: cvs commit: src/usr.sbin/newsyslog Makefile newsyslog.c Message-ID: <XFMail.010730112017.jhb@FreeBSD.org> In-Reply-To: <200107301811.f6UIB1J00180@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On 30-Jul-01 Garrett Wollman wrote: > <<On Mon, 30 Jul 2001 10:33:42 -0700 (PDT), John Baldwin <jhb@FreeBSD.org> > 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 <jhb@FreeBSD.org> -- 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010730112017.jhb>