diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/jsonapi.c | 16 | ||||
-rw-r--r-- | src/common/pg_lzcompress.c | 2 | ||||
-rw-r--r-- | src/common/scram-common.c | 2 | ||||
-rw-r--r-- | src/common/unicode/generate-norm_test_table.pl | 3 | ||||
-rw-r--r-- | src/common/unicode/generate-unicode_combining_table.pl | 51 | ||||
-rw-r--r-- | src/common/unicode/generate-unicode_norm_table.pl | 4 | ||||
-rw-r--r-- | src/common/unicode/generate-unicode_normprops_table.pl | 10 | ||||
-rw-r--r-- | src/common/unicode_norm.c | 22 |
8 files changed, 57 insertions, 53 deletions
diff --git a/src/common/jsonapi.c b/src/common/jsonapi.c index 7df231c3851..aa917d0fc9d 100644 --- a/src/common/jsonapi.c +++ b/src/common/jsonapi.c @@ -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'; diff --git a/src/common/pg_lzcompress.c b/src/common/pg_lzcompress.c index 80c86d7924e..d24d4803a98 100644 --- a/src/common/pg_lzcompress.c +++ b/src/common/pg_lzcompress.c @@ -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 diff --git a/src/common/scram-common.c b/src/common/scram-common.c index fe84fe9eac7..4971134b22a 100644 --- a/src/common/scram-common.c +++ b/src/common/scram-common.c @@ -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]; diff --git a/src/common/unicode/generate-norm_test_table.pl b/src/common/unicode/generate-norm_test_table.pl index 6417b3f0cd1..acc67967b7b 100644 --- a/src/common/unicode/generate-norm_test_table.pl +++ b/src/common/unicode/generate-norm_test_table.pl @@ -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 diff --git a/src/common/unicode/generate-unicode_combining_table.pl b/src/common/unicode/generate-unicode_combining_table.pl index e468a5f8c99..c0fc3cc2259 100644 --- a/src/common/unicode/generate-unicode_combining_table.pl +++ b/src/common/unicode/generate-unicode_combining_table.pl @@ -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]; - - 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; - } - } + chomp $line; + my @fields = split ';', $line; + $codepoint = hex $fields[0]; + + 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; + } + } } continue { - $prev_codepoint = $codepoint; + $prev_codepoint = $codepoint; } print "};\n"; diff --git a/src/common/unicode/generate-unicode_norm_table.pl b/src/common/unicode/generate-unicode_norm_table.pl index cd5f502d540..7ce15e1a039 100644 --- a/src/common/unicode/generate-unicode_norm_table.pl +++ b/src/common/unicode/generate-unicode_norm_table.pl @@ -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"; diff --git a/src/common/unicode/generate-unicode_normprops_table.pl b/src/common/unicode/generate-unicode_normprops_table.pl index c07a04a58aa..e8e5097c094 100644 --- a/src/common/unicode/generate-unicode_normprops_table.pl +++ b/src/common/unicode/generate-unicode_normprops_table.pl @@ -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; diff --git a/src/common/unicode_norm.c b/src/common/unicode_norm.c index 4f4c029075b..ab5ce593456 100644 --- a/src/common/unicode_norm.c +++ b/src/common/unicode_norm.c @@ -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 */ |