From d08596a653f1bec8badd630a186f43d9af8a6715 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 22 Oct 2016 13:27:56 -0600 Subject: [PATCH] libc/stdlib: Fix a few minor coding style issues --- libc/stdlib/lib_strtod.c | 18 +++++++++++------- libc/stdlib/lib_strtof.c | 18 +++++++++++------- libc/stdlib/lib_strtold.c | 20 ++++++++++++-------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/libc/stdlib/lib_strtod.c b/libc/stdlib/lib_strtod.c index 16d0dd331a..62da9e0f6e 100644 --- a/libc/stdlib/lib_strtod.c +++ b/libc/stdlib/lib_strtod.c @@ -140,12 +140,12 @@ double strtod(FAR const char *str, FAR char **endptr) p++; while (isdigit(*p)) - { - number = number * 10. + (*p - '0'); - p++; - num_digits++; - num_decimals++; - } + { + number = number * 10. + (*p - '0'); + p++; + num_digits++; + num_decimals++; + } exponent -= num_decimals; } @@ -212,7 +212,11 @@ double strtod(FAR const char *str, FAR char **endptr) p10 = 10.; n = exponent; - if (n < 0) n = -n; + if (n < 0) + { + n = -n; + } + while (n) { if (n & 1) diff --git a/libc/stdlib/lib_strtof.c b/libc/stdlib/lib_strtof.c index 6c19d6d285..467842f4e6 100644 --- a/libc/stdlib/lib_strtof.c +++ b/libc/stdlib/lib_strtof.c @@ -142,12 +142,12 @@ float strtof(FAR const char *str, FAR char **endptr) p++; while (isdigit(*p)) - { - number = number * 10.0F + (float)(*p - '0'); - p++; - num_digits++; - num_decimals++; - } + { + number = number * 10.0F + (float)(*p - '0'); + p++; + num_digits++; + num_decimals++; + } exponent -= num_decimals; } @@ -214,7 +214,11 @@ float strtof(FAR const char *str, FAR char **endptr) p10 = 10.0F; n = exponent; - if (n < 0) n = -n; + if (n < 0) + { + n = -n; + } + while (n) { if (n & 1) diff --git a/libc/stdlib/lib_strtold.c b/libc/stdlib/lib_strtold.c index b0d10399f9..c306392cec 100644 --- a/libc/stdlib/lib_strtold.c +++ b/libc/stdlib/lib_strtold.c @@ -140,12 +140,12 @@ long double strtold(FAR const char *str, FAR char **endptr) p++; while (isdigit(*p)) - { - number = number * 10.0L + (long double)(*p - '0'); - p++; - num_digits++; - num_decimals++; - } + { + number = number * 10.0L + (long double)(*p - '0'); + p++; + num_digits++; + num_decimals++; + } exponent -= num_decimals; } @@ -210,9 +210,13 @@ long double strtold(FAR const char *str, FAR char **endptr) /* Scale the result */ - p10 = 10.; + p10 = 10.0L; n = exponent; - if (n < 0) n = -n; + if (n < 0) + { + n = -n; + } + while (n) { if (n & 1)