You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-09-16 09:06:18 +02:00
Fix shims with more than one function.
Each subsequent function would double every line in the C module. Move the loop to detect shimmed functions down to prevent this issues.
This commit is contained in:
@@ -208,6 +208,7 @@
|
||||
<commit subject="Add shim feature for unit tests."/>
|
||||
<commit subject="Add local process shim."/>
|
||||
<commit subject="Add log shim."/>
|
||||
<commit subject="Fix shims with more than one function."/>
|
||||
|
||||
<p>Add local processs shim.</p>
|
||||
</release-item>
|
||||
|
@@ -400,9 +400,6 @@ sub run
|
||||
my $strFunctionShim = undef;
|
||||
|
||||
foreach my $strLine (split("\n", $strShimModuleSrc))
|
||||
{
|
||||
# Renamed shimmed functions
|
||||
foreach my $strFunction (@{$rhShim->{$strShimModule}{&TESTDEF_HARNESS_SHIM_FUNCTION}})
|
||||
{
|
||||
# If shimmed function declaration construction is in progress
|
||||
if (defined($strFunctionShim))
|
||||
@@ -426,6 +423,11 @@ sub run
|
||||
}
|
||||
# Else search for shimmed functions
|
||||
else
|
||||
{
|
||||
# Rename shimmed functions
|
||||
my $bFound = false;
|
||||
|
||||
foreach my $strFunction (@{$rhShim->{$strShimModule}{&TESTDEF_HARNESS_SHIM_FUNCTION}})
|
||||
{
|
||||
# If the function to shim is static then we need to create a declaration with the
|
||||
# original name so references to the original name in the C module will compile.
|
||||
@@ -439,15 +441,19 @@ sub run
|
||||
|
||||
$strLine =~ s/^${strFunction}\(/${strFunction}_SHIMMED\(/;
|
||||
$strFunctionShim = "${strLineLast}\n${strLine}\n";
|
||||
|
||||
$bFound = true;
|
||||
last;
|
||||
}
|
||||
# Else just append the line
|
||||
else
|
||||
}
|
||||
|
||||
# If the function was not found then just append the line
|
||||
if (!$bFound)
|
||||
{
|
||||
push(@stryShimModuleSrcRenamed, $strLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildPutDiffers(
|
||||
$self->{oStorageTest}, "${strShimSrcPath}/${strShimModule}.c",
|
||||
|
Reference in New Issue
Block a user