mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Initial pgindent and pgperltidy run for v13.
Includes some manual cleanup of places that pgindent messed up,
most of which weren't per project style anyway.
Notably, it seems some people didn't absorb the style rules of
commit c9d297751
, because there were a bunch of new occurrences
of function calls with a newline just after the left paren, all
with faulty expectations about how the rest of the call would get
indented.
This commit is contained in:
@@ -54,7 +54,7 @@ typedef enum /* contexts of JSON parser */
|
||||
|
||||
static inline JsonParseErrorType json_lex_string(JsonLexContext *lex);
|
||||
static inline JsonParseErrorType json_lex_number(JsonLexContext *lex, char *s,
|
||||
bool *num_err, int *total_len);
|
||||
bool *num_err, int *total_len);
|
||||
static inline JsonParseErrorType parse_scalar(JsonLexContext *lex, JsonSemAction *sem);
|
||||
static JsonParseErrorType parse_object_field(JsonLexContext *lex, JsonSemAction *sem);
|
||||
static JsonParseErrorType parse_object(JsonLexContext *lex, JsonSemAction *sem);
|
||||
@@ -179,7 +179,7 @@ JsonParseErrorType
|
||||
pg_parse_json(JsonLexContext *lex, JsonSemAction *sem)
|
||||
{
|
||||
JsonTokenType tok;
|
||||
JsonParseErrorType result;
|
||||
JsonParseErrorType result;
|
||||
|
||||
/* get the initial token */
|
||||
result = json_lex(lex);
|
||||
@@ -198,7 +198,7 @@ pg_parse_json(JsonLexContext *lex, JsonSemAction *sem)
|
||||
result = parse_array(lex, sem);
|
||||
break;
|
||||
default:
|
||||
result = parse_scalar(lex, sem); /* json can be a bare scalar */
|
||||
result = parse_scalar(lex, sem); /* json can be a bare scalar */
|
||||
}
|
||||
|
||||
if (result == JSON_SUCCESS)
|
||||
@@ -220,7 +220,7 @@ json_count_array_elements(JsonLexContext *lex, int *elements)
|
||||
{
|
||||
JsonLexContext copylex;
|
||||
int count;
|
||||
JsonParseErrorType result;
|
||||
JsonParseErrorType result;
|
||||
|
||||
/*
|
||||
* It's safe to do this with a shallow copy because the lexical routines
|
||||
@@ -252,7 +252,7 @@ json_count_array_elements(JsonLexContext *lex, int *elements)
|
||||
}
|
||||
}
|
||||
result = lex_expect(JSON_PARSE_ARRAY_NEXT, ©lex,
|
||||
JSON_TOKEN_ARRAY_END);
|
||||
JSON_TOKEN_ARRAY_END);
|
||||
if (result != JSON_SUCCESS)
|
||||
return result;
|
||||
|
||||
@@ -527,7 +527,7 @@ json_lex(JsonLexContext *lex)
|
||||
{
|
||||
char *s;
|
||||
int len;
|
||||
JsonParseErrorType result;
|
||||
JsonParseErrorType result;
|
||||
|
||||
/* Skip leading whitespace. */
|
||||
s = lex->token_terminator;
|
||||
@@ -1123,8 +1123,8 @@ json_errdetail(JsonParseErrorType error, JsonLexContext *lex)
|
||||
static char *
|
||||
extract_token(JsonLexContext *lex)
|
||||
{
|
||||
int toklen = lex->token_terminator - lex->token_start;
|
||||
char *token = palloc(toklen + 1);
|
||||
int toklen = lex->token_terminator - lex->token_start;
|
||||
char *token = palloc(toklen + 1);
|
||||
|
||||
memcpy(token, lex->token_start, toklen);
|
||||
token[toklen] = '\0';
|
||||
|
@@ -820,7 +820,7 @@ pglz_decompress(const char *source, int32 slen, char *dest,
|
||||
int32
|
||||
pglz_maximum_compressed_size(int32 rawsize, int32 total_compressed_size)
|
||||
{
|
||||
int32 compressed_size;
|
||||
int32 compressed_size;
|
||||
|
||||
/*
|
||||
* pglz uses one control bit per byte, so we need (rawsize * 9) bits. We
|
||||
|
@@ -190,7 +190,7 @@ scram_ServerKey(const uint8 *salted_password, uint8 *result)
|
||||
*/
|
||||
char *
|
||||
scram_build_secret(const char *salt, int saltlen, int iterations,
|
||||
const char *password)
|
||||
const char *password)
|
||||
{
|
||||
uint8 salted_password[SCRAM_KEY_LEN];
|
||||
uint8 stored_key[SCRAM_KEY_LEN];
|
||||
|
@@ -94,7 +94,8 @@ while (my $line = <$INPUT>)
|
||||
my $nfkc_utf8 = codepoint_string_to_hex($nfkc);
|
||||
my $nfkd_utf8 = codepoint_string_to_hex($nfkd);
|
||||
|
||||
print $OUTPUT "\t{ $linenum, { $source_utf8 }, { { $nfc_utf8 }, { $nfd_utf8 }, { $nfkc_utf8 }, { $nfkd_utf8 } } },\n";
|
||||
print $OUTPUT
|
||||
"\t{ $linenum, { $source_utf8 }, { { $nfc_utf8 }, { $nfd_utf8 }, { $nfkc_utf8 }, { $nfkd_utf8 } } },\n";
|
||||
}
|
||||
|
||||
# Output terminator entry
|
||||
|
@@ -14,39 +14,40 @@ my $codepoint;
|
||||
my $prev_codepoint;
|
||||
my $count = 0;
|
||||
|
||||
print "/* generated by src/common/unicode/generate-unicode_combining_table.pl, do not edit */\n\n";
|
||||
print
|
||||
"/* generated by src/common/unicode/generate-unicode_combining_table.pl, do not edit */\n\n";
|
||||
|
||||
print "static const struct mbinterval combining[] = {\n";
|
||||
|
||||
foreach my $line (<ARGV>)
|
||||
{
|
||||
chomp $line;
|
||||
my @fields = split ';', $line;
|
||||
$codepoint = hex $fields[0];
|
||||
chomp $line;
|
||||
my @fields = split ';', $line;
|
||||
$codepoint = hex $fields[0];
|
||||
|
||||
next if $codepoint > 0xFFFF;
|
||||
next if $codepoint > 0xFFFF;
|
||||
|
||||
if ($fields[2] eq 'Me' || $fields[2] eq 'Mn')
|
||||
{
|
||||
# combining character, save for start of range
|
||||
if (!defined($range_start))
|
||||
{
|
||||
$range_start = $codepoint;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# not a combining character, print out previous range if any
|
||||
if (defined($range_start))
|
||||
{
|
||||
printf "\t{0x%04X, 0x%04X},\n", $range_start, $prev_codepoint;
|
||||
$range_start = undef;
|
||||
}
|
||||
}
|
||||
if ($fields[2] eq 'Me' || $fields[2] eq 'Mn')
|
||||
{
|
||||
# combining character, save for start of range
|
||||
if (!defined($range_start))
|
||||
{
|
||||
$range_start = $codepoint;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# not a combining character, print out previous range if any
|
||||
if (defined($range_start))
|
||||
{
|
||||
printf "\t{0x%04X, 0x%04X},\n", $range_start, $prev_codepoint;
|
||||
$range_start = undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
{
|
||||
$prev_codepoint = $codepoint;
|
||||
$prev_codepoint = $codepoint;
|
||||
}
|
||||
|
||||
print "};\n";
|
||||
|
@@ -138,7 +138,7 @@ foreach my $char (@characters)
|
||||
# Decomposition size
|
||||
# Print size of decomposition
|
||||
my $decomp_size = scalar(@decomp_elts);
|
||||
die if $decomp_size > 0x1F; # to not overrun bitmask
|
||||
die if $decomp_size > 0x1F; # to not overrun bitmask
|
||||
|
||||
my $first_decomp = shift @decomp_elts;
|
||||
|
||||
@@ -153,7 +153,7 @@ foreach my $char (@characters)
|
||||
if ($decomp_size == 2)
|
||||
{
|
||||
# Should this be used for recomposition?
|
||||
if ($character_hash{$first_decomp}
|
||||
if ( $character_hash{$first_decomp}
|
||||
&& $character_hash{$first_decomp}->{class} != 0)
|
||||
{
|
||||
$flags .= " | DECOMP_NO_COMPOSE";
|
||||
|
@@ -11,7 +11,8 @@ use warnings;
|
||||
|
||||
my %data;
|
||||
|
||||
print "/* generated by src/common/unicode/generate-unicode_normprops_table.pl, do not edit */\n\n";
|
||||
print
|
||||
"/* generated by src/common/unicode/generate-unicode_normprops_table.pl, do not edit */\n\n";
|
||||
|
||||
print <<EOS;
|
||||
#include "common/unicode_norm.h"
|
||||
@@ -44,7 +45,7 @@ foreach my $line (<ARGV>)
|
||||
$first = $last = $codepoint;
|
||||
}
|
||||
|
||||
foreach my $cp (hex($first)..hex($last))
|
||||
foreach my $cp (hex($first) .. hex($last))
|
||||
{
|
||||
$data{$prop}{$cp} = $value;
|
||||
}
|
||||
@@ -61,9 +62,10 @@ foreach my $prop (sort keys %data)
|
||||
next if $prop eq "NFD_QC" || $prop eq "NFKD_QC";
|
||||
|
||||
print "\n";
|
||||
print "static const pg_unicode_normprops UnicodeNormProps_${prop}[] = {\n";
|
||||
print
|
||||
"static const pg_unicode_normprops UnicodeNormProps_${prop}[] = {\n";
|
||||
|
||||
my %subdata = %{$data{$prop}};
|
||||
my %subdata = %{ $data{$prop} };
|
||||
foreach my $cp (sort { $a <=> $b } keys %subdata)
|
||||
{
|
||||
my $qc;
|
||||
|
@@ -112,8 +112,8 @@ get_decomposed_size(pg_wchar code, bool compat)
|
||||
/*
|
||||
* Fast path for Hangul characters not stored in tables to save memory as
|
||||
* decomposition is algorithmic. See
|
||||
* https://www.unicode.org/reports/tr15/tr15-18.html, annex 10 for details on
|
||||
* the matter.
|
||||
* https://www.unicode.org/reports/tr15/tr15-18.html, annex 10 for details
|
||||
* on the matter.
|
||||
*/
|
||||
if (code >= SBASE && code < SBASE + SCOUNT)
|
||||
{
|
||||
@@ -238,8 +238,8 @@ decompose_code(pg_wchar code, bool compat, pg_wchar **result, int *current)
|
||||
/*
|
||||
* Fast path for Hangul characters not stored in tables to save memory as
|
||||
* decomposition is algorithmic. See
|
||||
* https://www.unicode.org/reports/tr15/tr15-18.html, annex 10 for details on
|
||||
* the matter.
|
||||
* https://www.unicode.org/reports/tr15/tr15-18.html, annex 10 for details
|
||||
* on the matter.
|
||||
*/
|
||||
if (code >= SBASE && code < SBASE + SCOUNT)
|
||||
{
|
||||
@@ -369,8 +369,8 @@ unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Per Unicode (https://www.unicode.org/reports/tr15/tr15-18.html) annex 4,
|
||||
* a sequence of two adjacent characters in a string is an
|
||||
* Per Unicode (https://www.unicode.org/reports/tr15/tr15-18.html)
|
||||
* annex 4, a sequence of two adjacent characters in a string is an
|
||||
* exchangeable pair if the combining class (from the Unicode
|
||||
* Character Database) for the first character is greater than the
|
||||
* combining class for the second, and the second is not a starter. A
|
||||
@@ -396,10 +396,10 @@ unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input)
|
||||
return decomp_chars;
|
||||
|
||||
/*
|
||||
* The last phase of NFC and NFKC is the recomposition of the reordered Unicode
|
||||
* string using combining classes. The recomposed string cannot be longer
|
||||
* than the decomposed one, so make the allocation of the output string
|
||||
* based on that assumption.
|
||||
* The last phase of NFC and NFKC is the recomposition of the reordered
|
||||
* Unicode string using combining classes. The recomposed string cannot be
|
||||
* longer than the decomposed one, so make the allocation of the output
|
||||
* string based on that assumption.
|
||||
*/
|
||||
recomp_chars = (pg_wchar *) ALLOC((decomp_size + 1) * sizeof(pg_wchar));
|
||||
if (!recomp_chars)
|
||||
@@ -551,4 +551,4 @@ unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* !FRONTEND */
|
||||
#endif /* !FRONTEND */
|
||||
|
Reference in New Issue
Block a user