From 411b5c2a8c3a2613e006219626e952ab1035f166 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 2 May 2021 21:35:11 -0500 Subject: [PATCH] Bugfix: Incorrect macro definition structure resulting in invalid inverse (!) checks. I seem to have forgotten to wrap these macro checks in parenthesis. As a result something like "!macro_f_file_type_is_block()" would expand to "!macro_f_file_type_get(mode) == f_file_type_block". What it should expand to should be logically equivalent to "macro_f_file_type_get(mode) != f_file_type_block". The expansion with the parenthesis would be: "!(macro_f_file_type_get(mode) == f_file_type_block)" and that is indeed logically equivalent. --- level_0/f_file/c/file-common.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/level_0/f_file/c/file-common.h b/level_0/f_file/c/file-common.h index 22f8e31..f79dd70 100644 --- a/level_0/f_file/c/file-common.h +++ b/level_0/f_file/c/file-common.h @@ -77,13 +77,13 @@ extern "C" { #define macro_f_file_type_get(mode) (f_file_type_mask & mode) - #define macro_f_file_type_is_block(mode) macro_f_file_type_get(mode) == f_file_type_block - #define macro_f_file_type_is_character(mode) macro_f_file_type_get(mode) == f_file_type_character - #define macro_f_file_type_is_directory(mode) macro_f_file_type_get(mode) == f_file_type_directory - #define macro_f_file_type_is_fifo(mode) macro_f_file_type_get(mode) == f_file_type_fifo - #define macro_f_file_type_is_link(mode) macro_f_file_type_get(mode) == f_file_type_link - #define macro_f_file_type_is_regular(mode) macro_f_file_type_get(mode) == f_file_type_regular - #define macro_f_file_type_is_socket(mode) macro_f_file_type_get(mode) == f_file_type_socket + #define macro_f_file_type_is_block(mode) (macro_f_file_type_get(mode) == f_file_type_block) + #define macro_f_file_type_is_character(mode) (macro_f_file_type_get(mode) == f_file_type_character) + #define macro_f_file_type_is_directory(mode) (macro_f_file_type_get(mode) == f_file_type_directory) + #define macro_f_file_type_is_fifo(mode) (macro_f_file_type_get(mode) == f_file_type_fifo) + #define macro_f_file_type_is_link(mode) (macro_f_file_type_get(mode) == f_file_type_link) + #define macro_f_file_type_is_regular(mode) (macro_f_file_type_get(mode) == f_file_type_regular) + #define macro_f_file_type_is_socket(mode) (macro_f_file_type_get(mode) == f_file_type_socket) #define macro_f_file_open_mode_append "a" #define macro_f_file_open_mode_read "r" -- 1.8.3.1