Commit cc794812 authored by Jonathan Corbet's avatar Jonathan Corbet

docs: kernel-doc: Move STATE_PROTO processing into its own function

Move the top-level prototype-processing code out of process_file().
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent d742f24d
...@@ -1965,6 +1965,32 @@ sub process_body($$) { ...@@ -1965,6 +1965,32 @@ sub process_body($$) {
} }
#
# STATE_PROTO: reading a function/whatever prototype.
#
sub process_proto($$) {
my $file = shift;
if (/$doc_inline_oneline/) {
$section = $1;
$contents = $2;
if ($contents ne "") {
$contents .= "\n";
dump_section($file, $section, $contents);
$section = $section_default;
$contents = "";
}
} elsif (/$doc_inline_start/) {
$state = STATE_INLINE;
$inline_doc_state = STATE_INLINE_NAME;
} elsif ($decl_type eq 'function') {
process_proto_function($_, $file);
} else {
process_proto_type($_, $file);
}
}
sub process_file($) { sub process_file($) {
my $file; my $file;
my $func; my $func;
...@@ -2031,24 +2057,8 @@ sub process_file($) { ...@@ -2031,24 +2057,8 @@ sub process_file($) {
++$warnings; ++$warnings;
} }
} }
} elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype) } elsif ($state == STATE_PROTO) {
if (/$doc_inline_oneline/) { process_proto($file, $_);
$section = $1;
$contents = $2;
if ($contents ne "") {
$contents .= "\n";
dump_section($file, $section, $contents);
$section = $section_default;
$contents = "";
}
} elsif (/$doc_inline_start/) {
$state = STATE_INLINE;
$inline_doc_state = STATE_INLINE_NAME;
} elsif ($decl_type eq 'function') {
process_proto_function($_, $file);
} else {
process_proto_type($_, $file);
}
} elsif ($state == STATE_DOCBLOCK) { } elsif ($state == STATE_DOCBLOCK) {
if (/$doc_end/) if (/$doc_end/)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment