[vlc-commits] check_headers: fix regular expression

Rémi Denis-Courmont git at videolan.org
Mon Jun 22 19:07:12 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 22 18:51:21 2015 +0300| [e051c631637b709c7f6c4b33e4af01707bbc2ac2] | committer: Rémi Denis-Courmont

check_headers: fix regular expression

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e051c631637b709c7f6c4b33e4af01707bbc2ac2
---

 src/check_headers |   25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/check_headers b/src/check_headers
index d0b4bb7..9441035 100755
--- a/src/check_headers
+++ b/src/check_headers
@@ -5,14 +5,23 @@ cd "$(dirname "$0")" || exit $?
 
 # Look for configure #defines in public headers.
 # There are incorrect, as external users don't have our <config.h>.
-regexp="$(cat ../config.h.in | \
-	sed -n -e 's/^#undef \([[:upper:][:digit:]_]*\)$/\1/p' | \
-	grep -v 'WORDS_BIGENDIAN' | \
-	grep -v 'UNICODE' | \
-	grep -v '__LIBVLC__' | \
-	xargs | \
-    sed -e 's/ /\\\(\\s\\\|$\\\)\\\| /g')"
-regexp=" $regexp\$"
+regexp=""
+
+while read l; do
+	d=$(echo "$l" | sed -n -e 's/^#undef \([[:upper:][:digit:]_]*\)$/\1/p')
+	test -z "$d" && continue
+	test "$d" = "WORDS_BIGENDIAN" && continue
+	test "$d" = "UNICODE" && continue
+	test "$d" = "__LIBVLC__" && continue
+
+	if test -z "$regexp"; then
+		regexp="[^A-Za-z0-9_]\("
+	else
+		regexp="${regexp}\|"
+	fi
+	regexp="${regexp}${d}"
+done < ../config.h.in
+regexp="${regexp}\)\([^A-Za-z0-9_]\|\$\)"
 
 echo Looking for private defines in public headers...
 ! grep -- "$regexp" "$@" || exit $?



More information about the vlc-commits mailing list