From e5ea84c1ff2e67ee8ea45736ba95c9198eb0406b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 6 Feb 2019 17:05:01 -0600 Subject: [PATCH] libs/libc/stdio: A few more coding standard fixes for nano-printf file: all global data names must begin with g_. All structure names must end with _s. --- libs/libc/stdio/nano_dtoa_data.c | 6 +++--- libs/libc/stdio/nano_dtoa_engine.c | 8 ++++---- libs/libc/stdio/nano_dtoa_engine.h | 10 +++++----- libs/libc/stdio/nano_libvsprintf.c | 2 +- libs/libc/stdio/nano_ultoa_invert.h | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/libs/libc/stdio/nano_dtoa_data.c b/libs/libc/stdio/nano_dtoa_data.c index cb8d5ec3a9..d31ff04037 100644 --- a/libs/libc/stdio/nano_dtoa_data.c +++ b/libs/libc/stdio/nano_dtoa_data.c @@ -68,7 +68,7 @@ * Public Data ****************************************************************************/ -const double __dtoa_scale_up[] = +const double g_dtoa_scale_up[] = { #if DBL_MAX_10_EXP >= 1 1e1, @@ -123,7 +123,7 @@ const double __dtoa_scale_up[] = #endif }; -const double __dtoa_scale_down[] = +const double g_dtoa_scale_down[] = { #if DBL_MIN_10_EXP <= -1 1e-1, @@ -178,7 +178,7 @@ const double __dtoa_scale_down[] = #endif }; -const double __dtoa_round[] = +const double g_dtoa_round[] = { #if DBL_DIG >= 30 5e30, diff --git a/libs/libc/stdio/nano_dtoa_engine.c b/libs/libc/stdio/nano_dtoa_engine.c index dc4d3578d5..a04ce4dcce 100644 --- a/libs/libc/stdio/nano_dtoa_engine.c +++ b/libs/libc/stdio/nano_dtoa_engine.c @@ -63,7 +63,7 @@ * Public Functions ****************************************************************************/ -int __dtoa_engine(double x, FAR struct dtoa *dtoa, int max_digits, +int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits, int max_decimals) { int32_t exp = 0; @@ -104,7 +104,7 @@ int __dtoa_engine(double x, FAR struct dtoa *dtoa, int max_digits, { for (i = DTOA_SCALE_UP_NUM - 1; i >= 0; i--) { - y = x * __dtoa_scale_up[i]; + y = x * g_dtoa_scale_up[i]; if (y < MAX_MANT) { x = y; @@ -116,7 +116,7 @@ int __dtoa_engine(double x, FAR struct dtoa *dtoa, int max_digits, { for (i = DTOA_SCALE_DOWN_NUM - 1; i >= 0; i--) { - y = x * __dtoa_scale_down[i]; + y = x * g_dtoa_scale_down[i]; if (y >= MIN_MANT) { x = y; @@ -139,7 +139,7 @@ int __dtoa_engine(double x, FAR struct dtoa *dtoa, int max_digits, * int. Check for overflow and adjust mantissa and exponent values */ - x = x + __dtoa_round[max_digits]; + x = x + g_dtoa_round[max_digits]; if (x >= MAX_MANT) { diff --git a/libs/libc/stdio/nano_dtoa_engine.h b/libs/libc/stdio/nano_dtoa_engine.h index 9f2b54a468..9ce3f1c2d9 100644 --- a/libs/libc/stdio/nano_dtoa_engine.h +++ b/libs/libc/stdio/nano_dtoa_engine.h @@ -164,7 +164,7 @@ * Public Types ****************************************************************************/ -struct dtoa +struct dtoa_s { int32_t exp; uint8_t flags; @@ -175,15 +175,15 @@ struct dtoa * Public Data ****************************************************************************/ -extern const double __dtoa_scale_up[]; -extern const double __dtoa_scale_down[]; -extern const double __dtoa_round[]; +extern const double g_dtoa_scale_up[]; +extern const double g_dtoa_scale_down[]; +extern const double g_dtoa_round[]; /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -int __dtoa_engine(double x, FAR struct dtoa *dtoa, int max_digits, +int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits, int max_decimals); #endif /* __LIBS_LIBC_STDIO_NANO_DTOA_ENGINE_H */ diff --git a/libs/libc/stdio/nano_libvsprintf.c b/libs/libc/stdio/nano_libvsprintf.c index f934b7b22d..026e567fb4 100644 --- a/libs/libc/stdio/nano_libvsprintf.c +++ b/libs/libc/stdio/nano_libvsprintf.c @@ -329,7 +329,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream, { unsigned char __buf[11]; /* Size for -1 in octal, without '\0' */ # if PRINTF_LEVEL >= PRINTF_FLT - struct dtoa __dtoa; + struct dtoa_s __dtoa; # endif } u; const char *pnt; diff --git a/libs/libc/stdio/nano_ultoa_invert.h b/libs/libc/stdio/nano_ultoa_invert.h index 0c07cb96c1..634d2eb88a 100644 --- a/libs/libc/stdio/nano_ultoa_invert.h +++ b/libs/libc/stdio/nano_ultoa_invert.h @@ -48,8 +48,8 @@ /* Next flags are to use with `base'. Unused fields are reserved. */ -#define XTOA_PREFIX 0x0100 /* Put prefix for octal or hex */ -#define XTOA_UPPER 0x0200 /* Use upper case letters */ +#define XTOA_PREFIX 0x0100 /* Put prefix for octal or hex */ +#define XTOA_UPPER 0x0200 /* Use upper case letters */ /**************************************************************************** * Public Function Prototypes