meson: deduplicate access to SHA1/SHA256 backend options
We've got a couple of repeated calls to `get_option()` for the SHA1 and SHA256 backend options. While not an issue, it makes the code needlessly verbose. Fix this by consistently using a local variable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Dec 30, 2024 at 15:24 UTC
31eb6d7cf09c3fa668c1839d8c5759ab7cdf280c
1 file changed
+3
-3
meson.build
+3
-3
@@ -1326,6 +1326,8 @@ if not meson.is_cross_build() and fs.exists('/dev/tty')
1326
endif
1327
1328
https_backend = get_option('https_backend')
1329
+sha1_backend = get_option('sha1_backend')
1330
+sha256_backend = get_option('sha256_backend')
1331
1332
security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
1333
core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
@@ -1333,7 +1335,7 @@ if https_backend == 'auto' and security_framework.found()
1335
https_backend = 'CommonCrypto'
1336
endif
1337
1336
-openssl_required = https_backend == 'openssl' or get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl'
1338
+openssl_required = https_backend == 'openssl' or sha1_backend == 'openssl' or sha256_backend == 'openssl'
1339
openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
1340
if https_backend == 'auto' and openssl.found()
1341
https_backend = 'openssl'
@@ -1354,7 +1356,6 @@ if https_backend != 'openssl'
1356
libgit_c_args += '-DNO_OPENSSL'
1357
endif
1358
1357
-sha1_backend = get_option('sha1_backend')
1359
if sha1_backend == 'sha1dc'
1360
libgit_c_args += '-DSHA1_DC'
1361
libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
@@ -1382,7 +1383,6 @@ else
1383
error('Unhandled SHA1 backend ' + sha1_backend)
1384
endif
1385
1385
-sha256_backend = get_option('sha256_backend')
1386
if sha256_backend == 'openssl'
1387
libgit_c_args += '-DSHA256_OPENSSL'
1388
libgit_dependencies += openssl