[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Factor the sed command used to make a regex from a literal.
From: |
Paolo Bonzini |
Subject: |
[PATCH] Factor the sed command used to make a regex from a literal. |
Date: |
Sun, 15 Aug 2010 19:06:25 +0200 |
In func_generate_dlsyms, the resulting regex is used with grep rather
than sed. I don't think grep has problems with \/ in practice, but of
course I can change it to use sed, too.
Ok? (if so, which way?)
Paolo
2010-08-15 Paolo Bonzini <address@hidden>
* libltdl/config/general.m4sh (sed_make_literal_regex): New.
* libltdl/config/ltmain.m4sh (func_generate_dlsyms,
func_cygming_dll_for_implib_fallback_core): Use it. Suggested
by Ralf Wildenhues.
---
ChangeLog | 8 ++++++++
libltdl/config/general.m4sh | 4 ++++
libltdl/config/ltmain.m4sh | 4 ++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 59e94e4..149462a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-15 Paolo Bonzini <address@hidden>
+
+ Factor the sed command used to make a regex from a literal.
+ * libltdl/config/general.m4sh (sed_make_literal_regex): New.
+ * libltdl/config/ltmain.m4sh (func_generate_dlsyms,
+ func_cygming_dll_for_implib_fallback_core): Use it. Suggested
+ by Ralf Wildenhues.
+
2010-08-13 Peter Rosin <address@hidden>
Allow the use of a listing file if the archiver supports it.
diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh
index 1245fe5..1ccb9b0 100644
--- a/libltdl/config/general.m4sh
+++ b/libltdl/config/general.m4sh
@@ -315,6 +315,10 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*/],\\\\&,g'
+
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index d334b65..acd1b3c 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -1972,7 +1972,7 @@ extern \"C\" {
}
else
$opt_dry_run || {
- eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e
's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval "${SED} -e '$sed_make_literal_regex' -e 's/^/ /' -e
's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" >
"$nlist"T'
eval '$MV "$nlist"T "$nlist"'
case $host in
@@ -2265,7 +2265,7 @@ func_cygming_dll_for_implib ()
func_cygming_dll_for_implib_fallback_core ()
{
$opt_debug
- match_literal=`$ECHO "$1" | $SED 's/[].[^$\\*|]/\\\\&/g'`
+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
$OBJDUMP -s --section "$1" "$2" 2>/dev/null |
$SED '/^Contents of section '"$match_literal"':/{
# Place marker at beginning of archive member dllname section
--
1.7.1
- [PATCH] Factor the sed command used to make a regex from a literal.,
Paolo Bonzini <=