This is (arguably) easier to read and reduces the total lines of code.

Signed-off-by: Michael Adler <[email protected]>
---
 env/env_config_file.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/env/env_config_file.c b/env/env_config_file.c
index e270fbb..0b6c5a4 100644
--- a/env/env_config_file.c
+++ b/env/env_config_file.c
@@ -21,12 +21,7 @@
 FILE *open_config_file(char *configfilepath, char *mode)
 {
        VERBOSE(stdout, "Probing config file at %s.\n", configfilepath);
-       FILE *config = fopen(configfilepath, mode);
-       if (config) {
-               return config;
-       } else {
-               return NULL;
-       }
+       return fopen(configfilepath, mode);
 }
 
 FILE *open_config_file_from_part(CONFIG_PART *cfgpart, char *mode)
@@ -51,10 +46,7 @@ FILE *open_config_file_from_part(CONFIG_PART *cfgpart, char 
*mode)
 
 int close_config_file(FILE *config_file_handle)
 {
-       if (config_file_handle) {
-               return fclose(config_file_handle);
-       }
-       return EINVAL;
+       return config_file_handle ? fclose(config_file_handle) : EINVAL;
 }
 
 bool probe_config_file(CONFIG_PART *cfgpart)
-- 
2.41.0

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/20230801112217.518248-1-michael.adler%40siemens.com.

Reply via email to