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.

This commit is contained in:
Gregory Nutt 2019-02-06 17:05:01 -06:00
parent e05149b745
commit e5ea84c1ff
5 changed files with 15 additions and 15 deletions

View File

@ -68,7 +68,7 @@
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
const double __dtoa_scale_up[] = const double g_dtoa_scale_up[] =
{ {
#if DBL_MAX_10_EXP >= 1 #if DBL_MAX_10_EXP >= 1
1e1, 1e1,
@ -123,7 +123,7 @@ const double __dtoa_scale_up[] =
#endif #endif
}; };
const double __dtoa_scale_down[] = const double g_dtoa_scale_down[] =
{ {
#if DBL_MIN_10_EXP <= -1 #if DBL_MIN_10_EXP <= -1
1e-1, 1e-1,
@ -178,7 +178,7 @@ const double __dtoa_scale_down[] =
#endif #endif
}; };
const double __dtoa_round[] = const double g_dtoa_round[] =
{ {
#if DBL_DIG >= 30 #if DBL_DIG >= 30
5e30, 5e30,

View File

@ -63,7 +63,7 @@
* Public Functions * 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) int max_decimals)
{ {
int32_t exp = 0; 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--) 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) if (y < MAX_MANT)
{ {
x = y; 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--) 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) if (y >= MIN_MANT)
{ {
x = y; 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 * 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) if (x >= MAX_MANT)
{ {

View File

@ -164,7 +164,7 @@
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
struct dtoa struct dtoa_s
{ {
int32_t exp; int32_t exp;
uint8_t flags; uint8_t flags;
@ -175,15 +175,15 @@ struct dtoa
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
extern const double __dtoa_scale_up[]; extern const double g_dtoa_scale_up[];
extern const double __dtoa_scale_down[]; extern const double g_dtoa_scale_down[];
extern const double __dtoa_round[]; extern const double g_dtoa_round[];
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * 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); int max_decimals);
#endif /* __LIBS_LIBC_STDIO_NANO_DTOA_ENGINE_H */ #endif /* __LIBS_LIBC_STDIO_NANO_DTOA_ENGINE_H */

View File

@ -329,7 +329,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream,
{ {
unsigned char __buf[11]; /* Size for -1 in octal, without '\0' */ unsigned char __buf[11]; /* Size for -1 in octal, without '\0' */
# if PRINTF_LEVEL >= PRINTF_FLT # if PRINTF_LEVEL >= PRINTF_FLT
struct dtoa __dtoa; struct dtoa_s __dtoa;
# endif # endif
} u; } u;
const char *pnt; const char *pnt;

View File

@ -48,8 +48,8 @@
/* Next flags are to use with `base'. Unused fields are reserved. */ /* Next flags are to use with `base'. Unused fields are reserved. */
#define XTOA_PREFIX 0x0100 /* Put prefix for octal or hex */ #define XTOA_PREFIX 0x0100 /* Put prefix for octal or hex */
#define XTOA_UPPER 0x0200 /* Use upper case letters */ #define XTOA_UPPER 0x0200 /* Use upper case letters */
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes