Module: gas-preprocessor
Branch: master
Commit: 0b4738e1e50184a9523da4cb2a19cad942645915

Author:    Martin Storsjo <[email protected]>
Committer: Martin Storsjo <[email protected]>
Date:      Tue Jul 23 10:36:11 2013 +0300

Only replace symbols with their corresponding value if the symbol is defined

This avoids replacing a substring like x0123 in hex constants with
an empty string.

---

 gas-preprocessor.pl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 803f3b0..f932c60 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -135,7 +135,10 @@ while (<ASMFILE>) {
 
 sub eval_expr {
     my $expr = $_[0];
-    $expr =~ s/([A-Za-z._][A-Za-z0-9._]*)/$symbols{$1}/g;
+    while ($expr =~ /([A-Za-z._][A-Za-z0-9._]*)/g) {
+        my $sym = $1;
+        $expr =~ s/$sym/$symbols{$sym}/ if defined $symbols{$sym};
+    }
     eval $expr;
 }
 

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to