Message ID | 1508013322-19428-4-git-send-email-martin@martin.st |
---|---|
State | Committed |
Headers | show |
On 2017-10-14 23:35:18 +0300, Martin Storsjö wrote: > Since we're doing a replace of a string that looks like e.g "1b" > over a full line, such a string could concievably be a substring of > another identifier as well. > > This doesn't fix any known issue, but attempts to make this > less fragile. > --- > gas-preprocessor.pl | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl > index 09fcf0e..fe9c746 100755 > --- a/gas-preprocessor.pl > +++ b/gas-preprocessor.pl > @@ -631,12 +631,12 @@ sub handle_local_label { > my $dir = $_[2]; > my $target = "$num$dir"; > if ($dir eq "b") { > - $line =~ s/$target/$last_temp_labels{$num}/g; > + $line =~ s/\b$target\b/$last_temp_labels{$num}/g; > } else { > my $name = "temp_label_$temp_label_next"; > $temp_label_next++; > push(@{$next_temp_labels{$num}}, $name); > - $line =~ s/$target/$name/g; > + $line =~ s/\b$target\b/$name/g; > } > return $line; > } ok Janne
diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl index 09fcf0e..fe9c746 100755 --- a/gas-preprocessor.pl +++ b/gas-preprocessor.pl @@ -631,12 +631,12 @@ sub handle_local_label { my $dir = $_[2]; my $target = "$num$dir"; if ($dir eq "b") { - $line =~ s/$target/$last_temp_labels{$num}/g; + $line =~ s/\b$target\b/$last_temp_labels{$num}/g; } else { my $name = "temp_label_$temp_label_next"; $temp_label_next++; push(@{$next_temp_labels{$num}}, $name); - $line =~ s/$target/$name/g; + $line =~ s/\b$target\b/$name/g; } return $line; }