1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-12-13 23:25:51 +02:00

Remove redundant lines from embedded Perl by combining blank lines.

This commit is contained in:
David Steele
2018-07-28 08:43:58 -04:00
parent 666537cbde
commit cb975a5330
3 changed files with 2342 additions and 6235 deletions

View File

@@ -76,6 +76,8 @@ sub buildEmbed
" .name = \"${strModule}\",\n" .
" .data =\n";
my $strLfLine = undef;
# Process each line
foreach my $strLine (split("\n", $strData))
{
@@ -92,9 +94,20 @@ sub buildEmbed
# Remove leading/trailing spaces
$strLine = trim($strLine);
# Output line
$strBuildSource .=
" \"$strLine\\n\"\n";
# If empty line then add it to the total empty lines
if ($strLine eq "")
{
$strLfLine .= "\\n";
}
# Output line (and empty lines if any)
else
{
$strBuildSource .=
(defined($strLfLine) ? " \"$strLfLine\"\n" : '') .
" \"$strLine\\n\"\n";
$strLfLine = undef;
}
}
$strBuildSource .=