|
3 | 3 | * show.c: show backup information. |
4 | 4 | * |
5 | 5 | * 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 |
7 | 7 | * |
8 | 8 | *------------------------------------------------------------------------- |
9 | 9 | */ |
@@ -1015,6 +1015,12 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size, |
1015 | 1015 | timelineInfo *tlinfo = (timelineInfo *) parray_get(actual_tli_list, i); |
1016 | 1016 | char tmp_buf[MAXFNAMELEN]; |
1017 | 1017 | 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 |
1018 | 1024 |
|
1019 | 1025 | if (i != (parray_num(actual_tli_list) - 1)) |
1020 | 1026 | appendPQExpBufferChar(buf, ','); |
@@ -1047,25 +1053,24 @@ show_archive_json(const char *instance_name, uint32 xlog_seg_size, |
1047 | 1053 |
|
1048 | 1054 | json_add_key(buf, "zratio", json_level); |
1049 | 1055 |
|
1050 | | - // forcing comma-based floating point representation |
1051 | | - locale_t saveloc; |
| 1056 | + /* forcing comma-based floating point representation */ |
1052 | 1057 | #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); |
1054 | 1059 | saveloc = uselocale(newloc); |
1055 | 1060 | #else |
1056 | 1061 | #ifdef HAVE__CONFIGTHREADLOCALE |
1057 | | - locale_t oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); |
| 1062 | + oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE); |
1058 | 1063 | #endif |
1059 | 1064 | saveloc = setlocale(LC_NUMERIC, NULL); |
1060 | 1065 | setlocale(LC_NUMERIC, "C"); |
1061 | 1066 | #endif |
1062 | 1067 | 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; |
1064 | 1069 | appendPQExpBuffer(buf, "%.2f", zratio); |
1065 | 1070 |
|
1066 | | - // restoring previous locale |
| 1071 | + /* restoring previous locale */ |
1067 | 1072 | #ifdef HAVE_USELOCALE |
1068 | | - if(saveloc != (locale_t)0) |
| 1073 | + if(saveloc != (locale_t) 0) |
1069 | 1074 | uselocale(saveloc); |
1070 | 1075 | freelocale(newloc); |
1071 | 1076 | #else |
|
0 commit comments