mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Initial pgindent run for v12.
This is still using the 2.0 version of pg_bsd_indent. I thought it would be good to commit this separately, so as to document the differences between 2.0 and 2.1 behavior. Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us
This commit is contained in:
@ -671,9 +671,9 @@ to_chars_df(const floating_decimal_64 v, const uint32 olength, char *const resul
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We can save some code later by pre-filling with zeros. We know
|
||||
* that there can be no more than 16 output digits in this form,
|
||||
* otherwise we would not choose fixed-point output.
|
||||
* We can save some code later by pre-filling with zeros. We know that
|
||||
* there can be no more than 16 output digits in this form, otherwise
|
||||
* we would not choose fixed-point output.
|
||||
*/
|
||||
Assert(exp < 16 && exp + olength <= 16);
|
||||
memset(result, '0', 16);
|
||||
@ -800,8 +800,8 @@ to_chars(floating_decimal_64 v, const bool sign, char *const result)
|
||||
|
||||
/*
|
||||
* The thresholds for fixed-point output are chosen to match printf
|
||||
* defaults. Beware that both the code of to_chars_df and the value
|
||||
* of DOUBLE_SHORTEST_DECIMAL_LEN are sensitive to these thresholds.
|
||||
* defaults. Beware that both the code of to_chars_df and the value of
|
||||
* DOUBLE_SHORTEST_DECIMAL_LEN are sensitive to these thresholds.
|
||||
*/
|
||||
if (exp >= -4 && exp < 15)
|
||||
return to_chars_df(v, olength, result + index) + sign;
|
||||
|
@ -481,10 +481,10 @@ to_chars_f(const floating_decimal_32 v, const uint32 olength, char *const result
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We can save some code later by pre-filling with zeros. We know
|
||||
* that there can be no more than 6 output digits in this form,
|
||||
* otherwise we would not choose fixed-point output. memset 8
|
||||
* rather than 6 bytes to let the compiler optimize it.
|
||||
* We can save some code later by pre-filling with zeros. We know that
|
||||
* there can be no more than 6 output digits in this form, otherwise
|
||||
* we would not choose fixed-point output. memset 8 rather than 6
|
||||
* bytes to let the compiler optimize it.
|
||||
*/
|
||||
Assert(exp < 6 && exp + olength <= 6);
|
||||
memset(result, '0', 8);
|
||||
@ -575,8 +575,8 @@ to_chars(const floating_decimal_32 v, const bool sign, char *const result)
|
||||
|
||||
/*
|
||||
* The thresholds for fixed-point output are chosen to match printf
|
||||
* defaults. Beware that both the code of to_chars_f and the value
|
||||
* of FLOAT_SHORTEST_DECIMAL_LEN are sensitive to these thresholds.
|
||||
* defaults. Beware that both the code of to_chars_f and the value of
|
||||
* FLOAT_SHORTEST_DECIMAL_LEN are sensitive to these thresholds.
|
||||
*/
|
||||
if (exp >= -4 && exp < 6)
|
||||
return to_chars_f(v, olength, result + index) + sign;
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define MINIMUM_VERSION_FOR_PG_WAL 100000
|
||||
|
||||
#ifdef PG_FLUSH_DATA_WORKS
|
||||
static int pre_sync_fname(const char *fname, bool isdir);
|
||||
static int pre_sync_fname(const char *fname, bool isdir);
|
||||
#endif
|
||||
static void walkdir(const char *path,
|
||||
int (*action) (const char *fname, bool isdir),
|
||||
|
@ -16,10 +16,10 @@
|
||||
enum pg_log_level __pg_log_level;
|
||||
|
||||
static const char *progname;
|
||||
static int log_flags;
|
||||
static int log_flags;
|
||||
|
||||
static void (*log_pre_callback)(void);
|
||||
static void (*log_locus_callback)(const char **, uint64 *);
|
||||
static void (*log_pre_callback) (void);
|
||||
static void (*log_locus_callback) (const char **, uint64 *);
|
||||
|
||||
static const char *sgr_error = NULL;
|
||||
static const char *sgr_warning = NULL;
|
||||
@ -60,13 +60,13 @@ pg_logging_init(const char *argv0)
|
||||
|
||||
if (pg_colors_env)
|
||||
{
|
||||
char *colors = strdup(pg_colors_env);
|
||||
char *colors = strdup(pg_colors_env);
|
||||
|
||||
if (colors)
|
||||
{
|
||||
for (char *token = strtok(colors, ":"); token; token = strtok(NULL, ":"))
|
||||
{
|
||||
char *e = strchr(token, '=');
|
||||
char *e = strchr(token, '=');
|
||||
|
||||
if (e)
|
||||
{
|
||||
@ -111,19 +111,19 @@ pg_logging_set_level(enum pg_log_level new_level)
|
||||
}
|
||||
|
||||
void
|
||||
pg_logging_set_pre_callback(void (*cb)(void))
|
||||
pg_logging_set_pre_callback(void (*cb) (void))
|
||||
{
|
||||
log_pre_callback = cb;
|
||||
}
|
||||
|
||||
void
|
||||
pg_logging_set_locus_callback(void (*cb)(const char **filename, uint64 *lineno))
|
||||
pg_logging_set_locus_callback(void (*cb) (const char **filename, uint64 *lineno))
|
||||
{
|
||||
log_locus_callback = cb;
|
||||
}
|
||||
|
||||
void
|
||||
pg_log_generic(enum pg_log_level level, const char * pg_restrict fmt, ...)
|
||||
pg_log_generic(enum pg_log_level level, const char *pg_restrict fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@ -133,7 +133,7 @@ pg_log_generic(enum pg_log_level level, const char * pg_restrict fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
pg_log_generic_v(enum pg_log_level level, const char * pg_restrict fmt, va_list ap)
|
||||
pg_log_generic_v(enum pg_log_level level, const char *pg_restrict fmt, va_list ap)
|
||||
{
|
||||
int save_errno = errno;
|
||||
const char *filename = NULL;
|
||||
|
@ -687,7 +687,7 @@ pglz_compress(const char *source, int32 slen, char *dest,
|
||||
*/
|
||||
int32
|
||||
pglz_decompress(const char *source, int32 slen, char *dest,
|
||||
int32 rawsize, bool check_complete)
|
||||
int32 rawsize, bool check_complete)
|
||||
{
|
||||
const unsigned char *sp;
|
||||
const unsigned char *srcend;
|
||||
@ -759,10 +759,9 @@ pglz_decompress(const char *source, int32 slen, char *dest,
|
||||
}
|
||||
|
||||
/*
|
||||
* Check we decompressed the right amount.
|
||||
* If we are slicing, then we won't necessarily
|
||||
* be at the end of the source or dest buffers
|
||||
* when we hit a stop, so we don't test them.
|
||||
* Check we decompressed the right amount. If we are slicing, then we
|
||||
* won't necessarily be at the end of the source or dest buffers when we
|
||||
* hit a stop, so we don't test them.
|
||||
*/
|
||||
if (check_complete && (dp != destend || sp != srcend))
|
||||
return -1;
|
||||
@ -770,5 +769,5 @@ pglz_decompress(const char *source, int32 slen, char *dest,
|
||||
/*
|
||||
* That's it.
|
||||
*/
|
||||
return (char*)dp - dest;
|
||||
return (char *) dp - dest;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ rmtree(const char *path, bool rmtopdir)
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
pg_log_warning("could not stat file or directory \"%s\": %m",
|
||||
pathbuf);
|
||||
pathbuf);
|
||||
result = false;
|
||||
}
|
||||
continue;
|
||||
@ -99,7 +99,7 @@ rmtree(const char *path, bool rmtopdir)
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
pg_log_warning("could not remove file or directory \"%s\": %m",
|
||||
pathbuf);
|
||||
pathbuf);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ rmtree(const char *path, bool rmtopdir)
|
||||
if (rmdir(path) != 0)
|
||||
{
|
||||
pg_log_warning("could not remove file or directory \"%s\": %m",
|
||||
path);
|
||||
path);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user