Skip to content

Commit

Permalink
OpenSSL::Ordinals: add a renumber() function, to assign unassigned sy…
Browse files Browse the repository at this point in the history
…mbols

This should be used when it's time to assign constant numbers to the
unassigned symbols.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from #10348)
  • Loading branch information
levitte committed Nov 5, 2019
1 parent 3da95f3 commit 81ddd95
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion util/perl/OpenSSL/Ordinals.pm
Expand Up @@ -169,7 +169,26 @@ sub load {
return 1;
}

=item B<$ordinals-E<gt>rewrite>
=item B<< $ordinals->renumber >>
Renumber any item that doesn't have an assigned number yet.
=cut

sub renumber {
my $self = shift;

my $max_assigned = 0;
foreach ($self->items(by => by_number())) {
$_->number($_->intnum()) if $_->number() =~ m|^\?|;
if ($max_assigned < $_->number()) {
$max_assigned = $_->number();
}
}
$self->{maxassigned} = $max_assigned;
}

=item B<< $ordinals->rewrite >>
If an ordinals file has been loaded, it gets rewritten with the data from
the current work database.
Expand Down

0 comments on commit 81ddd95

Please sign in to comment.