mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-29 12:32:48 +00:00
Shorten encoding of version features
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
b02f006685
commit
90dfc21f6b
@ -44,6 +44,12 @@ int mbedtls_version_check_feature(const char *feature)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strncmp(feature, "MBEDTLS_", 8)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
feature += 8;
|
||||
|
||||
while (*idx != NULL) {
|
||||
if (!strcmp(*idx, feature)) {
|
||||
return 0;
|
||||
|
@ -66,11 +66,14 @@ while (my $line = <CONFIG_H>)
|
||||
$in_section = 0;
|
||||
next;
|
||||
}
|
||||
|
||||
my ($define) = $line =~ /#define (\w+)/;
|
||||
$feature_defines .= "#if defined(${define})\n";
|
||||
# Strip leading MBEDTLS_ to save binary size
|
||||
my ($mbedtls_prefix, $define) = $line =~ /#define (MBEDTLS_)?(\w+)/;
|
||||
if (!$mbedtls_prefix) {
|
||||
die "Feature does not start with 'MBEDTLS_': $line\n";
|
||||
}
|
||||
$feature_defines .= "#if defined(MBEDTLS_${define})\n";
|
||||
$feature_defines .= " \"${define}\",\n";
|
||||
$feature_defines .= "#endif /* ${define} */\n";
|
||||
$feature_defines .= "#endif /* MBEDTLS_${define} */\n";
|
||||
}
|
||||
|
||||
if (!$in_section) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user