From 81ddd952ea1c4f80df45435fb927fd0c6314a008 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 4 Nov 2019 10:29:53 +0100 Subject: [PATCH] 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) --- util/perl/OpenSSL/Ordinals.pm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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. -- 2.25.1