
2012/12/13 Marek Vasut marex@denx.de:
Dear Richard Genoud,
ifdefs in the code are making it harder to read. The use of simple if(VFAT_ENABLED) makes no more code and is cleaner. (the code is discarded by the compiler and linker instead of the preprocessor.)
and bonus, now the code compiles even if CONFIG_SUPPORT_VFAT is not defined.
Signed-off-by: Richard Genoud richard.genoud@gmail.com
fs/fat/fat.c | 55 +++++++++++++++++++++++++++------------------------ fs/fat/fat_write.c | 11 ++------- 2 files changed, 32 insertions(+), 34 deletions(-)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 393c378..c79e3e3 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -34,6 +34,12 @@ #include <malloc.h> #include <linux/compiler.h>
+#ifdef CONFIG_SUPPORT_VFAT +#define VFAT_ENABLED 1 +#else +#define VFAT_ENABLED 0 +#endif
[...]
Make it static const int maybe ?
I hesitate to make them static const, I can't figure why it's better to use static const variable instead of defines. Could you enlighten me ?
Best regards, Richard.