mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 09:15:35 +00:00
generate_errors.pl: refactor and simplify the code
This commit is contained in:
parent
e90205f9e6
commit
463f049ef0
|
@ -54,31 +54,19 @@ close(FORMAT_FILE);
|
|||
|
||||
$/ = $line_separator;
|
||||
|
||||
my %files;
|
||||
|
||||
if( $include_crypto ) {
|
||||
my @crypto_headers = <$crypto_dir/$include_dir/*.h>;
|
||||
my @mbedtls_files = <$include_dir/*.h>;
|
||||
$files{$_}++ for (@crypto_headers);
|
||||
|
||||
foreach my $file (@mbedtls_files) {
|
||||
my $stripped_filename = substr($file, rindex($file,"/")+1, length($file)-rindex($file,"/")-1);
|
||||
my $crypto_counterpart = "$crypto_dir/$include_dir/$stripped_filename";
|
||||
if ( exists $files{$crypto_counterpart} ){
|
||||
next;
|
||||
}
|
||||
else{
|
||||
push(@{$files{$file}});
|
||||
}
|
||||
my @headers = ();
|
||||
if ($include_crypto) {
|
||||
@headers = <$crypto_dir/$include_dir/*.h>;
|
||||
foreach my $header (<$include_dir/*.h>) {
|
||||
my $basename = $header; $basename =~ s!.*/!!;
|
||||
push @headers, $header unless -e "$crypto_dir/$include_dir/$basename";
|
||||
}
|
||||
}
|
||||
else{
|
||||
my @headers = <$include_dir/*.h>;
|
||||
$files{$_}++ for (@headers);
|
||||
} else {
|
||||
@headers = <$include_dir/*.h>;
|
||||
}
|
||||
|
||||
my @matches;
|
||||
foreach my $file (sort keys %files) {
|
||||
foreach my $file (@headers) {
|
||||
open(FILE, "$file");
|
||||
my @grep_res = grep(/^\s*#define\s+MBEDTLS_ERR_\w+\s+\-0x[0-9A-Fa-f]+/, <FILE>);
|
||||
push(@matches, @grep_res);
|
||||
|
|
Loading…
Reference in a new issue