Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib Simplify error condition case.



details:   https://anonhg.NetBSD.org/src/rev/fd4f25f75c13
branches:  trunk
changeset: 348740:fd4f25f75c13
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Nov 04 20:16:18 2016 +0000

description:
Simplify error condition case.

Add assertions to reflect its implications.

diffstat:

 lib/libc/stdlib/strtol.3 |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 92fd00077720 -r fd4f25f75c13 lib/libc/stdlib/strtol.3
--- a/lib/libc/stdlib/strtol.3  Fri Nov 04 20:14:31 2016 +0000
+++ b/lib/libc/stdlib/strtol.3  Fri Nov 04 20:16:18 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: strtol.3,v 1.36 2016/11/04 20:14:31 riastradh Exp $
+.\"    $NetBSD: strtol.3,v 1.37 2016/11/04 20:16:18 riastradh Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -229,8 +229,11 @@
        goto not_a_number;
 if (*ep != '\e0')
        goto trailing_garbage;
-if (errno == ERANGE \*[Am]\*[Am] (lval == LONG_MAX || lval == LONG_MIN))
+if (errno) {
+       assert(errno == ERANGE);
+       assert(lval == LONG_MAX || lval == LONG_MIN);
        goto out_of_range;
+}
 .Ed
 .Pp
 This example will accept



Home | Main Index | Thread Index | Old Index