Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make: in TryParseNumber, reset errno as late as...



details:   https://anonhg.NetBSD.org/src/rev/964bfacc7d72
branches:  trunk
changeset: 984898:964bfacc7d72
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 29 06:35:20 2021 +0000

description:
make: in TryParseNumber, reset errno as late as possible

No functional change.

diffstat:

 usr.bin/make/cond.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 4ae5d0d437a9 -r 964bfacc7d72 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Thu Jul 29 06:31:18 2021 +0000
+++ b/usr.bin/make/cond.c       Thu Jul 29 06:35:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.269 2021/06/21 21:10:01 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.270 2021/07/29 06:35:20 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.269 2021/06/21 21:10:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.270 2021/07/29 06:35:20 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -376,12 +376,12 @@
        unsigned long ul_val;
        double dbl_val;
 
-       errno = 0;
        if (str[0] == '\0') {   /* XXX: why is an empty string a number? */
                *out_value = 0.0;
                return true;
        }
 
+       errno = 0;
        ul_val = strtoul(str, &end, str[1] == 'x' ? 16 : 10);
        if (*end == '\0' && errno != ERANGE) {
                *out_value = str[0] == '-' ? -(double)-ul_val : (double)ul_val;



Home | Main Index | Thread Index | Old Index