From: Richard Levitte Date: Mon, 4 Nov 2019 09:29:53 +0000 (+0100) Subject: OpenSSL::Ordinals: add a renumber() function, to assign unassigned symbols X-Git-Tag: openssl-3.0.0-alpha1~1017 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=81ddd952ea1c4f80df45435fb927fd0c6314a008;p=oweals%2Fopenssl.git OpenSSL::Ordinals: add a renumber() function, to assign unassigned symbols This should be used when it's time to assign constant numbers to the unassigned symbols. Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/10348) --- diff --git a/util/perl/OpenSSL/Ordinals.pm b/util/perl/OpenSSL/Ordinals.pm index 55d5b2f0e3..411cdc9d60 100644 --- a/util/perl/OpenSSL/Ordinals.pm +++ b/util/perl/OpenSSL/Ordinals.pm @@ -169,7 +169,26 @@ sub load { return 1; } -=item B<$ordinals-Erewrite> +=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.