From: Kevin Day Date: Mon, 3 May 2021 02:35:11 +0000 (-0500) Subject: Bugfix: Incorrect macro definition structure resulting in invalid inverse (!) checks. X-Git-Tag: 0.5.4~61 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=411b5c2a8c3a2613e006219626e952ab1035f166;p=fll 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. --- 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"