mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-11 05:55:36 +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;
|
$/ = $line_separator;
|
||||||
|
|
||||||
my %files;
|
my @headers = ();
|
||||||
|
if ($include_crypto) {
|
||||||
if( $include_crypto ) {
|
@headers = <$crypto_dir/$include_dir/*.h>;
|
||||||
my @crypto_headers = <$crypto_dir/$include_dir/*.h>;
|
foreach my $header (<$include_dir/*.h>) {
|
||||||
my @mbedtls_files = <$include_dir/*.h>;
|
my $basename = $header; $basename =~ s!.*/!!;
|
||||||
$files{$_}++ for (@crypto_headers);
|
push @headers, $header unless -e "$crypto_dir/$include_dir/$basename";
|
||||||
|
|
||||||
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}});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
@headers = <$include_dir/*.h>;
|
||||||
my @headers = <$include_dir/*.h>;
|
|
||||||
$files{$_}++ for (@headers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my @matches;
|
my @matches;
|
||||||
foreach my $file (sort keys %files) {
|
foreach my $file (@headers) {
|
||||||
open(FILE, "$file");
|
open(FILE, "$file");
|
||||||
my @grep_res = grep(/^\s*#define\s+MBEDTLS_ERR_\w+\s+\-0x[0-9A-Fa-f]+/, <FILE>);
|
my @grep_res = grep(/^\s*#define\s+MBEDTLS_ERR_\w+\s+\-0x[0-9A-Fa-f]+/, <FILE>);
|
||||||
push(@matches, @grep_res);
|
push(@matches, @grep_res);
|
||||||
|
|
Loading…
Reference in a new issue