UAPI: Strip _UAPI prefix on header install no matter the whitespace
authorDavid Howells <dhowells@redhat.com>
Wed, 2 Jan 2013 15:13:02 +0000 (15:13 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 3 Jan 2013 01:36:10 +0000 (17:36 -0800)
Commit 56c176c9cac9 ("UAPI: strip the _UAPI prefix from header guards
during header installation") strips the _UAPI prefix from header guards,
but only if there's a single space between the cpp directive and the
label.

Make it more flexible and able to handle tabs and multiple white space
characters.

Signed-off-by: David Howells <dhowell@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/headers_install.pl

index 6c353ae8a4517b1e7ab4b2b4fa28012e96de9921..581ca99c96f29829507c6b43fdd278781fc3b2a9 100644 (file)
@@ -42,9 +42,9 @@ foreach my $filename (@files) {
                $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
                $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
                $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
-               $line =~ s/#ifndef _UAPI/#ifndef /;
-               $line =~ s/#define _UAPI/#define /;
-               $line =~ s!#endif /[*] _UAPI!#endif /* !;
+               $line =~ s/#ifndef\s+_UAPI/#ifndef /;
+               $line =~ s/#define\s+_UAPI/#define /;
+               $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !;
                printf {$out} "%s", $line;
        }
        close $out;