[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] xstrtol: simplify integer overflow checking
From: |
Jim Meyering |
Subject: |
Re: [PATCH 2/2] xstrtol: simplify integer overflow checking |
Date: |
Mon, 17 Jan 2022 10:16:44 +0100 |
On Mon, Jan 17, 2022 at 7:53 AM Paul Eggert <eggert@cs.ucla.edu> wrote:
> * lib/xstrtol.c: Include intprops.h.
> (TYPE_SIGNED): Remove, as intprops.h defines that for us now.
> (bkm_scale): Use INT_MULTIPLY_WRAPV instead of checking for
> overflow by hand.
Thanks. I've just pushed this, too.
xstrtol: remove unnecessary else after return
* lib/xstrtol.c (bkm_scale): Drop "else" after return.
diff --git a/ChangeLog b/ChangeLog
index 2ea372b0e3..ff78fda8f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-17 Jim Meyering <meyering@fb.com>
+
+ xstrtol: remove unnecessary else after return
+ * lib/xstrtol.c (bkm_scale): Drop "else" after return.
+
2022-01-16 Paul Eggert <eggert@cs.ucla.edu>
xstrtol: simplify integer overflow checking
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index 6f5a8bef60..3e2efb2a17 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -52,8 +52,8 @@ bkm_scale (__strtol_t *x, int scale_factor)
*x = *x < 0 ? TYPE_MINIMUM (__strtol_t) : TYPE_MAXIMUM (__strtol_t);
return LONGINT_OVERFLOW;
}
- else
- *x = scaled;
+
+ *x = scaled;
return LONGINT_OK;
}