diff options
author | Karl Williamson <khw@cpan.org> | 2020-09-05 16:40:17 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-09-05 17:31:10 -0600 |
commit | 53c9fbf247994f1801bc7c27feddc1feb3d95ff8 (patch) | |
tree | 6668378b119eb5cfe0a4b3d699dd84dec4a4e0f1 /autodoc.pl | |
parent | 8d1c4423972d220897e8e728ad14d8a0db1146a4 (diff) | |
download | perl-53c9fbf247994f1801bc7c27feddc1feb3d95ff8.tar.gz |
autodoc: Avoid a loop iteration
Initializing everything with the first elements values allows us to not
look at that element again. Previously, only somethings were so
initialized.
Diffstat (limited to 'autodoc.pl')
-rw-r--r-- | autodoc.pl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/autodoc.pl b/autodoc.pl index 4a0c26d7c9..40e1fd4c42 100644 --- a/autodoc.pl +++ b/autodoc.pl @@ -1121,13 +1121,14 @@ sub docout ($$$) { # output the docs for one function # return type and arguments, only the main entry is displayed. # Also, find the longest return type and longest name so that if # multiple ones are shown, they can be vertically aligned nicely - my $longest_ret = 0; - my $longest_name_length = 0; my $need_individual_usage = 0; + my $longest_name_length = length $items[0]->{name}; my $base_ret_type = $items[0]->{ret_type}; + my $longest_ret = length $base_ret_type; my @base_args = $items[0]->{args}->@*; - for my $item (@items) { + for (my $i = 1; $i < @items; $i++) { no warnings 'experimental::smartmatch'; + my $item = $items[$i]; $need_individual_usage = 1 if $item->{ret_type} ne $base_ret_type || ! ($item->{args}->@* ~~ @base_args); |