Skip to content

Commit 31eb6d7

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8214e27 commit 31eb6d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,14 +1326,16 @@ if not meson.is_cross_build() and fs.exists('/dev/tty')
13261326
endif
13271327

13281328
https_backend = get_option('https_backend')
1329+
sha1_backend = get_option('sha1_backend')
1330+
sha256_backend = get_option('sha256_backend')
13291331

13301332
security_framework = dependency('Security', required: https_backend == 'CommonCrypto')
13311333
core_foundation_framework = dependency('CoreFoundation', required: security_framework.found())
13321334
if https_backend == 'auto' and security_framework.found()
13331335
https_backend = 'CommonCrypto'
13341336
endif
13351337

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'
13371339
openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static'])
13381340
if https_backend == 'auto' and openssl.found()
13391341
https_backend = 'openssl'
@@ -1354,7 +1356,6 @@ if https_backend != 'openssl'
13541356
libgit_c_args += '-DNO_OPENSSL'
13551357
endif
13561358

1357-
sha1_backend = get_option('sha1_backend')
13581359
if sha1_backend == 'sha1dc'
13591360
libgit_c_args += '-DSHA1_DC'
13601361
libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1'
@@ -1382,7 +1383,6 @@ else
13821383
error('Unhandled SHA1 backend ' + sha1_backend)
13831384
endif
13841385

1385-
sha256_backend = get_option('sha256_backend')
13861386
if sha256_backend == 'openssl'
13871387
libgit_c_args += '-DSHA256_OPENSSL'
13881388
libgit_dependencies += openssl

0 commit comments

Comments
 (0)