kernel-doc: escape xml for structs

scripts/kernel-doc was leaving unescaped '<', '>', and '&' in
generated xml output for structs. This causes xml parser errors.
Convert these characters to "&lt;", "&gt;", and "&amp;" as needed
to prevent errors.

Most of the conversion was already done; complete it just before
output.

Documentation/DocBook/device-drivers.xml:41883: parser error : StartTag: invalid element name
#define INPUT_KEYMAP_BY_INDEX (1 << 0)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Randy Dunlap and committed by Linus Torvalds 2b35f4d9 2811036a

+9 -3
+9 -3
scripts/kernel-doc
··· 5 5 ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## 6 6 ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 7 7 ## Copyright (C) 2001 Simon Huggins ## 8 - ## Copyright (C) 2005-2009 Randy Dunlap ## 8 + ## Copyright (C) 2005-2010 Randy Dunlap ## 9 9 ## ## 10 10 ## #define enhancements by Armin Kuster <akuster@mvista.com> ## 11 11 ## Copyright (c) 2000 MontaVista Software, Inc. ## ··· 453 453 if ($output_mode eq "html" || $output_mode eq "xml") { 454 454 $contents = local_unescape($contents); 455 455 # convert data read & converted thru xml_escape() into &xyz; format: 456 - $contents =~ s/\\\\\\/&/g; 456 + $contents =~ s/\\\\\\/\&/g; 457 457 } 458 458 # print STDERR "contents b4:$contents\n"; 459 459 eval $dohighlight; ··· 770 770 print $args{'type'} . " " . $args{'struct'} . " {\n"; 771 771 foreach $parameter (@{$args{'parameterlist'}}) { 772 772 if ($parameter =~ /^#/) { 773 - print "$parameter\n"; 773 + my $prm = $parameter; 774 + # convert data read & converted thru xml_escape() into &xyz; format: 775 + # This allows us to have #define macros interspersed in a struct. 776 + $prm =~ s/\\\\\\/\&/g; 777 + print "$prm\n"; 774 778 next; 775 779 } 776 780 ··· 1704 1700 ++$warnings; 1705 1701 } 1706 1702 } 1703 + 1704 + $param = xml_escape($param); 1707 1705 1708 1706 # strip spaces from $param so that it is one continous string 1709 1707 # on @parameterlist;