diff options
| author | Tom Lane | 2023-05-19 21:24:48 +0000 |
|---|---|---|
| committer | Tom Lane | 2023-05-19 21:24:48 +0000 |
| commit | 0245f8db36f375326c2bae0c3420d3c77714e72d (patch) | |
| tree | 7ce91f23658a05ea24be4703fb06cdc6b56248f7 /src/bin/initdb | |
| parent | df6b19fbbc20d830de91d9bea68715a39635b568 (diff) | |
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files.
This set of diffs is a bit larger than typical. We've updated to
pg_bsd_indent 2.1.2, which properly indents variable declarations that
have multi-line initialization expressions (the continuation lines are
now indented one tab stop). We've also updated to perltidy version
20230309 and changed some of its settings, which reduces its desire to
add whitespace to lines to make assignments etc. line up. Going
forward, that should make for fewer random-seeming changes to existing
code.
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql
Diffstat (limited to 'src/bin/initdb')
| -rw-r--r-- | src/bin/initdb/initdb.c | 51 | ||||
| -rw-r--r-- | src/bin/initdb/t/001_initdb.pl | 20 |
2 files changed, 35 insertions, 36 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 30b576932fd..31156e863ba 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1565,8 +1565,8 @@ static void setup_auth(FILE *cmdfd) { /* - * The authid table shouldn't be readable except through views, to - * ensure passwords are not publicly visible. + * The authid table shouldn't be readable except through views, to ensure + * passwords are not publicly visible. */ PG_CMD_PUTS("REVOKE ALL ON pg_authid FROM public;\n\n"); @@ -1957,9 +1957,9 @@ make_template0(FILE *cmdfd) " STRATEGY = file_copy;\n\n"); /* - * template0 shouldn't have any collation-dependent objects, so unset - * the collation version. This disables collation version checks when - * making a new database from it. + * template0 shouldn't have any collation-dependent objects, so unset the + * collation version. This disables collation version checks when making + * a new database from it. */ PG_CMD_PUTS("UPDATE pg_database SET datcollversion = NULL WHERE datname = 'template0';\n\n"); @@ -1969,9 +1969,8 @@ make_template0(FILE *cmdfd) PG_CMD_PUTS("UPDATE pg_database SET datcollversion = pg_database_collation_actual_version(oid) WHERE datname = 'template1';\n\n"); /* - * Explicitly revoke public create-schema and create-temp-table - * privileges in template1 and template0; else the latter would be on - * by default + * Explicitly revoke public create-schema and create-temp-table privileges + * in template1 and template0; else the latter would be on by default */ PG_CMD_PUTS("REVOKE CREATE,TEMPORARY ON DATABASE template1 FROM public;\n\n"); PG_CMD_PUTS("REVOKE CREATE,TEMPORARY ON DATABASE template0 FROM public;\n\n"); @@ -2244,11 +2243,11 @@ static char * icu_language_tag(const char *loc_str) { #ifdef USE_ICU - UErrorCode status; - char lang[ULOC_LANG_CAPACITY]; - char *langtag; - size_t buflen = 32; /* arbitrary starting buffer size */ - const bool strict = true; + UErrorCode status; + char lang[ULOC_LANG_CAPACITY]; + char *langtag; + size_t buflen = 32; /* arbitrary starting buffer size */ + const bool strict = true; status = U_ZERO_ERROR; uloc_getLanguage(loc_str, lang, ULOC_LANG_CAPACITY, &status); @@ -2264,8 +2263,8 @@ icu_language_tag(const char *loc_str) return pstrdup("en-US-u-va-posix"); /* - * A BCP47 language tag doesn't have a clearly-defined upper limit - * (cf. RFC5646 section 4.4). Additionally, in older ICU versions, + * A BCP47 language tag doesn't have a clearly-defined upper limit (cf. + * RFC5646 section 4.4). Additionally, in older ICU versions, * uloc_toLanguageTag() doesn't always return the ultimate length on the * first call, necessitating a loop. */ @@ -2298,7 +2297,7 @@ icu_language_tag(const char *loc_str) return langtag; #else pg_fatal("ICU is not supported in this build"); - return NULL; /* keep compiler quiet */ + return NULL; /* keep compiler quiet */ #endif } @@ -2311,9 +2310,9 @@ static void icu_validate_locale(const char *loc_str) { #ifdef USE_ICU - UErrorCode status; - char lang[ULOC_LANG_CAPACITY]; - bool found = false; + UErrorCode status; + char lang[ULOC_LANG_CAPACITY]; + bool found = false; /* validate that we can extract the language */ status = U_ZERO_ERROR; @@ -2334,8 +2333,8 @@ icu_validate_locale(const char *loc_str) /* search for matching language within ICU */ for (int32_t i = 0; !found && i < uloc_countAvailable(); i++) { - const char *otherloc = uloc_getAvailable(i); - char otherlang[ULOC_LANG_CAPACITY]; + const char *otherloc = uloc_getAvailable(i); + char otherlang[ULOC_LANG_CAPACITY]; status = U_ZERO_ERROR; uloc_getLanguage(otherloc, otherlang, ULOC_LANG_CAPACITY, &status); @@ -2366,10 +2365,10 @@ static char * default_icu_locale(void) { #ifdef USE_ICU - UCollator *collator; - UErrorCode status; - const char *valid_locale; - char *default_locale; + UCollator *collator; + UErrorCode status; + const char *valid_locale; + char *default_locale; status = U_ZERO_ERROR; collator = ucol_open(NULL, &status); @@ -2449,7 +2448,7 @@ setlocales(void) if (locale_provider == COLLPROVIDER_ICU) { - char *langtag; + char *langtag; /* acquire default locale from the environment, if not specified */ if (icu_locale == NULL) diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl index 17a444d80c5..fa00bb3dabe 100644 --- a/src/bin/initdb/t/001_initdb.pl +++ b/src/bin/initdb/t/001_initdb.pl @@ -105,7 +105,7 @@ if ($ENV{with_icu} eq 'yes') { command_ok( [ - 'initdb', '--no-sync', + 'initdb', '--no-sync', '--locale-provider=icu', '--icu-locale=en', "$tempdir/data3" ], @@ -113,7 +113,7 @@ if ($ENV{with_icu} eq 'yes') command_fails_like( [ - 'initdb', '--no-sync', + 'initdb', '--no-sync', '--locale-provider=icu', '--icu-locale=@colNumeric=lower', "$tempdir/dataX" ], @@ -122,7 +122,7 @@ if ($ENV{with_icu} eq 'yes') command_fails_like( [ - 'initdb', '--no-sync', + 'initdb', '--no-sync', '--locale-provider=icu', '--encoding=SQL_ASCII', '--icu-locale=en', "$tempdir/dataX" ], @@ -131,18 +131,18 @@ if ($ENV{with_icu} eq 'yes') command_fails_like( [ - 'initdb', '--no-sync', - '--locale-provider=icu', - '--icu-locale=nonsense-nowhere', "$tempdir/dataX" + 'initdb', '--no-sync', + '--locale-provider=icu', '--icu-locale=nonsense-nowhere', + "$tempdir/dataX" ], qr/error: locale "nonsense-nowhere" has unknown language "nonsense"/, 'fails for nonsense language'); command_fails_like( [ - 'initdb', '--no-sync', - '--locale-provider=icu', - '--icu-locale=@colNumeric=lower', "$tempdir/dataX" + 'initdb', '--no-sync', + '--locale-provider=icu', '--icu-locale=@colNumeric=lower', + "$tempdir/dataX" ], qr/could not open collator for locale "und-u-kn-lower": U_ILLEGAL_ARGUMENT_ERROR/, 'fails for invalid collation argument'); @@ -160,7 +160,7 @@ command_fails( command_fails( [ - 'initdb', '--no-sync', + 'initdb', '--no-sync', '--locale-provider=libc', '--icu-locale=en', "$tempdir/dataX" ], |
