Skip to content

Commit b329493

Browse files
committed
[PBCKP-216] remove warning: ISO C90 forbids mixed declarations and code + codestyle fixes
1 parent 2aee16c commit b329493

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/show.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* show.c: show backup information.
44
*
55
* Portions Copyright (c) 2009-2011, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6-
* Portions Copyright (c) 2015-2019, Postgres Professional
6+
* Portions Copyright (c) 2015-2022, Postgres Professional
77
*
88
*-------------------------------------------------------------------------
99
*/
@@ -1015,6 +1015,12 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
10151015
timelineInfo *tlinfo = (timelineInfo *) parray_get(actual_tli_list, i);
10161016
char tmp_buf[MAXFNAMELEN];
10171017
float zratio = 0;
1018+
locale_t saveloc;
1019+
#ifdef HAVE_USELOCALE
1020+
locale_t newloc;
1021+
#elif HAVE__CONFIGTHREADLOCALE
1022+
locale_t oldthreadlocale;
1023+
#endif
10181024

10191025
if (i != (parray_num(actual_tli_list) - 1))
10201026
appendPQExpBufferChar(buf, ',');
@@ -1047,25 +1053,24 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size,
10471053

10481054
json_add_key(buf, "zratio", json_level);
10491055

1050-
// forcing comma-based floating point representation
1051-
locale_t saveloc;
1056+
/* forcing comma-based floating point representation */
10521057
#ifdef HAVE_USELOCALE
1053-
locale_t newloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0);
1058+
newloc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
10541059
saveloc = uselocale(newloc);
10551060
#else
10561061
#ifdef HAVE__CONFIGTHREADLOCALE
1057-
locale_t oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
1062+
oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
10581063
#endif
10591064
saveloc = setlocale(LC_NUMERIC, NULL);
10601065
setlocale(LC_NUMERIC, "C");
10611066
#endif
10621067
if (tlinfo->size != 0)
1063-
zratio = ((float)xlog_seg_size*tlinfo->n_xlog_files) / tlinfo->size;
1068+
zratio = ((float) xlog_seg_size * tlinfo->n_xlog_files) / tlinfo->size;
10641069
appendPQExpBuffer(buf, "%.2f", zratio);
10651070

1066-
// restoring previous locale
1071+
/* restoring previous locale */
10671072
#ifdef HAVE_USELOCALE
1068-
if(saveloc != (locale_t)0)
1073+
if(saveloc != (locale_t) 0)
10691074
uselocale(saveloc);
10701075
freelocale(newloc);
10711076
#else

0 commit comments

Comments
 (0)