From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Thu, 13 Dec 2012 13:46:32 +0100 Subject: [U-Boot] [PATCH 1/2] FAT: remove ifdefs to make the code more readable In-Reply-To: <1355395656-5838-2-git-send-email-richard.genoud@gmail.com> References: <50BE21CC.4030603@denx.de> <1355395656-5838-2-git-send-email-richard.genoud@gmail.com> Message-ID: <201212131346.32912.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.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 > --- > 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 > #include > > +#ifdef CONFIG_SUPPORT_VFAT > +#define VFAT_ENABLED 1 > +#else > +#define VFAT_ENABLED 0 > +#endif [...] Make it static const int maybe ? Best regards, Marek Vasut