diff options
| author | Dennis Tseng <dennis.tseng@suse.com> | 2024-07-03 13:15:58 +0800 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2025-01-15 16:41:38 -0500 |
| commit | 0345331fa871650faaa5a34baa9c3b30fea10667 (patch) | |
| tree | b645d6797b395484513c1660b9fbb757b336cb2e | |
| parent | ad8692e848cb520d734fbb075c30dcc3307ef8a4 (diff) | |
| download | efi-boot-shim-0345331fa871650faaa5a34baa9c3b30fea10667.tar.gz efi-boot-shim-0345331fa871650faaa5a34baa9c3b30fea10667.zip | |
Improve shortcut performance when comparing two boolean expressions
In original sbat.c:
...
else if (preserve_sbat_uefi_variable(sbat, sbatsize, attributes,
sbat_var_candidate) &&
!reset_sbat) {
...
The time omplexity of preserve_sbat_uefi_variable() is higher than
reset_sbat. Maybe we could swap both of them to calculate reset_sbat
first. Such that the shortcut performance can be improved.
Signed-off-by: Dennis Tseng <dennis.tseng@suse.com>
| -rw-r--r-- | sbat.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -537,9 +537,9 @@ set_sbat_uefi_variable(char *sbat_var_automatic, char *sbat_var_latest) */ if (EFI_ERROR(efi_status)) { dprint(L"SBAT read failed %r\n", efi_status); - } else if (preserve_sbat_uefi_variable(sbat, sbatsize, attributes, - sbat_var_candidate) && - !reset_sbat) { + } else if (!reset_sbat && + preserve_sbat_uefi_variable(sbat, sbatsize, attributes, + sbat_var_candidate)) { dprint(L"preserving %s variable it is %d bytes, attributes are 0x%08x\n", SBAT_VAR_NAME, sbatsize, attributes); FreePool(sbat); |
