Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1e5eaf0

Browse files
j-naylorpull[bot]
authored andcommitted
Run perltidy over Catalog.pm
Commit69eb643 deliberately left indentation unchanged to make the changesmore legible. Rather than waiting until next year's perltidy run, do it nowto avoid confusionPer suggestion from Álvaro HerreraDiscussion:https://www.postgresql.org/message-id/20220907083558.vfvb5hcauaictgum%40alvherre.pgsql
1 parentcaabdaa commit1e5eaf0

File tree

1 file changed

+56
-55
lines changed

1 file changed

+56
-55
lines changed

‎src/backend/catalog/Catalog.pm

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -289,71 +289,72 @@ sub ParseData
289289

290290
if ($preserve_formatting)
291291
{
292-
# Scan the input file.
293-
while (<$ifd>)
294-
{
295-
my$hash_ref;
296-
297-
if (/{/)
292+
# Scan the input file.
293+
while (<$ifd>)
298294
{
299-
# Capture the hash ref
300-
# NB: Assumes that the next hash ref can't start on the
301-
# same line where the present one ended.
302-
# Not foolproof, but we shouldn't need a full parser,
303-
# since we expect relatively well-behaved input.
304-
305-
# Quick hack to detect when we have a full hash ref to
306-
# parse. We can't just use a regex because of values in
307-
# pg_aggregate and pg_proc like '{0,0}'. This will need
308-
# work if we ever need to allow unbalanced braces within
309-
# a field value.
310-
my$lcnt =tr/{//;
311-
my$rcnt =tr/}//;
312-
313-
if ($lcnt ==$rcnt)
295+
my$hash_ref;
296+
297+
if (/{/)
314298
{
315-
# We're treating the input line as a piece of Perl, so we
316-
# need to use string eval here. Tell perlcritic we know what
317-
# we're doing.
318-
eval'$hash_ref =' .$_;## no critic (ProhibitStringyEval)
319-
if (!ref$hash_ref)
299+
# Capture the hash ref
300+
# NB: Assumes that the next hash ref can't start on the
301+
# same line where the present one ended.
302+
# Not foolproof, but we shouldn't need a full parser,
303+
# since we expect relatively well-behaved input.
304+
305+
# Quick hack to detect when we have a full hash ref to
306+
# parse. We can't just use a regex because of values in
307+
# pg_aggregate and pg_proc like '{0,0}'. This will need
308+
# work if we ever need to allow unbalanced braces within
309+
# a field value.
310+
my$lcnt =tr/{//;
311+
my$rcnt =tr/}//;
312+
313+
if ($lcnt ==$rcnt)
320314
{
321-
die"$input_file: error parsing line$.:\n$_\n";
322-
}
315+
# We're treating the input line as a piece of Perl, so we
316+
# need to use string eval here. Tell perlcritic we know what
317+
# we're doing.
318+
eval'$hash_ref ='
319+
.$_;## no critic (ProhibitStringyEval)
320+
if (!ref$hash_ref)
321+
{
322+
die"$input_file: error parsing line$.:\n$_\n";
323+
}
324+
325+
# Annotate each hash with the source line number.
326+
$hash_ref->{line_number} =$.;
323327

324-
# Annotate each hash with the source line number.
325-
$hash_ref->{line_number} =$.;
328+
# Expand tuples to their full representation.
329+
AddDefaultValues($hash_ref,$schema,$catname);
330+
}
331+
else
332+
{
333+
my$next_line = <$ifd>;
334+
die"$input_file: file ends within Perl hash\n"
335+
if !defined$next_line;
336+
$_ .=$next_line;
337+
redo;
338+
}
339+
}
326340

327-
# Expand tuples to their full representation.
328-
AddDefaultValues($hash_ref,$schema,$catname);
341+
# If we found a hash reference, keep it, unless it is marked as
342+
# autogenerated; in that case it'd duplicate an entry we'll
343+
# autogenerate below. (This makes it safe for reformat_dat_file.pl
344+
# with --full-tuples to print autogenerated entries, which seems like
345+
# useful behavior for debugging.)
346+
#
347+
# Otherwise, we have a non-data string, which we need to keep in
348+
# order to preserve formatting.
349+
if (defined$hash_ref)
350+
{
351+
push@$data,$hash_refif !$hash_ref->{autogenerated};
329352
}
330353
else
331354
{
332-
my$next_line = <$ifd>;
333-
die"$input_file: file ends within Perl hash\n"
334-
if !defined$next_line;
335-
$_ .=$next_line;
336-
redo;
355+
push@$data,$_;
337356
}
338357
}
339-
340-
# If we found a hash reference, keep it, unless it is marked as
341-
# autogenerated; in that case it'd duplicate an entry we'll
342-
# autogenerate below. (This makes it safe for reformat_dat_file.pl
343-
# with --full-tuples to print autogenerated entries, which seems like
344-
# useful behavior for debugging.)
345-
#
346-
# Otherwise, we have a non-data string, which we need to keep in
347-
# order to preserve formatting.
348-
if (defined$hash_ref)
349-
{
350-
push@$data,$hash_refif !$hash_ref->{autogenerated};
351-
}
352-
else
353-
{
354-
push@$data,$_;
355-
}
356-
}
357358
}
358359
else
359360
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp