[U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable
Marek Vasut
marex at denx.de
Thu Dec 13 13:46:32 CET 2012
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 at 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 ?
Best regards,
Marek Vasut
More information about the U-Boot
mailing list