kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 00f505e3f3e60c46b6199bf45041b6694af8ec1b
parent 88330a5fcd7125f81c0eb6f2b0ffdc06b5bb8d7a
Author: Joris Vink <joris@coders.se>
Date:   Sun, 20 Oct 2019 23:43:54 +0200

simplify strtod() error checking.

we can just check if errno is ERANGE and drop d == 0 comparison.

Diffstat:
src/utils.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/utils.c b/src/utils.c @@ -239,7 +239,7 @@ kore_strtodouble(const char *str, long double min, long double max, int *err) errno = 0; d = strtod(str, &ep); - if (d == 0 || errno == ERANGE || str == ep || *ep != '\0') { + if (errno == ERANGE || str == ep || *ep != '\0') { *err = KORE_RESULT_ERROR; return (0); }