Module Name: src
Committed By: riastradh
Date: Fri Nov 4 20:16:18 UTC 2016
Modified Files:
src/lib/libc/stdlib: strtol.3
Log Message:
Simplify error condition case.
Add assertions to reflect its implications.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/stdlib/strtol.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdlib/strtol.3
diff -u src/lib/libc/stdlib/strtol.3:1.36 src/lib/libc/stdlib/strtol.3:1.37
--- src/lib/libc/stdlib/strtol.3:1.36 Fri Nov 4 20:14:31 2016
+++ src/lib/libc/stdlib/strtol.3 Fri Nov 4 20:16:18 2016
@@ -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 @@ if (ep == buf)
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