Commit 5eb0da05 authored by Tobin C. Harding's avatar Tobin C. Harding

leaking_addresses: add is_arch() wrapper subroutine

Currently there is duplicate code when checking the architecture type.
We can remove the duplication by implementing a wrapper function
is_arch().

Implement and use wrapper function is_arch().
Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
parent 6efb7458
...@@ -170,24 +170,26 @@ sub is_supported_architecture ...@@ -170,24 +170,26 @@ sub is_supported_architecture
return (is_x86_64() or is_ppc64()); return (is_x86_64() or is_ppc64());
} }
sub is_x86_64 sub is_arch
{ {
my $archname = `uname -m`; my ($desc) = @_;
my $arch = `uname -m`;
if ($archname =~ m/x86_64/) { chomp $arch;
if ($arch eq $desc) {
return 1; return 1;
} }
return 0; return 0;
} }
sub is_ppc64 sub is_x86_64
{ {
my $archname = `uname -m`; return is_arch('x86_64');
}
if ($archname =~ m/ppc64/) { sub is_ppc64
return 1; {
} return is_arch('ppc64');
return 0;
} }
# Gets config option value from kernel config file. # Gets config option value from kernel config file.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment