diff mbox

[U-Boot,2/2] FAT: use toupper/tolower instead of recoding them

Message ID 1355395656-5838-3-git-send-email-richard.genoud@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Richard Genoud Dec. 13, 2012, 10:47 a.m. UTC
toupper/tolower function are already declared, so use them.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 fs/fat/fat.c       |    3 ++-
 fs/fat/fat_write.c |    3 ++-
 include/fat.h      |    3 ---
 3 files changed, 4 insertions(+), 5 deletions(-)

Comments

Marek Vasut Dec. 13, 2012, 12:47 p.m. UTC | #1
Dear Richard Genoud,

> toupper/tolower function are already declared, so use them.
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
>  fs/fat/fat.c       |    3 ++-
>  fs/fat/fat_write.c |    3 ++-
>  include/fat.h      |    3 ---
>  3 files changed, 4 insertions(+), 5 deletions(-)

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Stefano Babic Dec. 14, 2012, 8:56 a.m. UTC | #2
On 13/12/2012 11:47, Richard Genoud wrote:
> toupper/tolower function are already declared, so use them.
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
>  fs/fat/fat.c       |    3 ++-
>  fs/fat/fat_write.c |    3 ++-
>  include/fat.h      |    3 ---
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index c79e3e3..cff0526 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -33,6 +33,7 @@
>  #include <part.h>
>  #include <malloc.h>
>  #include <linux/compiler.h>
> +#include <linux/ctype.h>
>  
>  #ifdef CONFIG_SUPPORT_VFAT
>  #define VFAT_ENABLED 1
> @@ -46,7 +47,7 @@
>  static void downcase(char *str)
>  {
>  	while (*str != '\0') {
> -		TOLOWER(*str);
> +		*str = tolower(*str);
>  		str++;
>  	}
>  }
> diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
> index ed3eaa0..13c4de1 100644
> --- a/fs/fat/fat_write.c
> +++ b/fs/fat/fat_write.c
> @@ -28,6 +28,7 @@
>  #include <fat.h>
>  #include <asm/byteorder.h>
>  #include <part.h>
> +#include <linux/ctype.h>
>  #include "fat.c"
>  
>  static void uppercase(char *str, int len)
> @@ -35,7 +36,7 @@ static void uppercase(char *str, int len)
>  	int i;
>  
>  	for (i = 0; i < len; i++) {
> -		TOUPPER(*str);
> +		*str = toupper(*str);
>  		str++;
>  	}
>  }
> diff --git a/include/fat.h b/include/fat.h
> index 706cd7a..b28c3fd 100644
> --- a/include/fat.h
> +++ b/include/fat.h
> @@ -98,9 +98,6 @@
>  #endif
>  #endif
>  
> -#define TOLOWER(c)	if((c) >= 'A' && (c) <= 'Z'){(c)+=('a' - 'A');}
> -#define TOUPPER(c)	if ((c) >= 'a' && (c) <= 'z') \
> -				(c) -= ('a' - 'A');
>  #define START(dent)	(FAT2CPU16((dent)->start) \
>  			+ (mydata->fatsize != 32 ? 0 : \
>  			  (FAT2CPU16((dent)->starthi) << 16)))
> 

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Tom Rini Feb. 4, 2013, 4:41 p.m. UTC | #3
On Thu, Dec 13, 2012 at 12:47:36AM -0000, Richard Genoud wrote:

> toupper/tolower function are already declared, so use them.
> 
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> Acked-by: Marek Vasut <marex@denx.de>
> Acked-by: Stefano Babic <sbabic@denx.de>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index c79e3e3..cff0526 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -33,6 +33,7 @@ 
 #include <part.h>
 #include <malloc.h>
 #include <linux/compiler.h>
+#include <linux/ctype.h>
 
 #ifdef CONFIG_SUPPORT_VFAT
 #define VFAT_ENABLED 1
@@ -46,7 +47,7 @@ 
 static void downcase(char *str)
 {
 	while (*str != '\0') {
-		TOLOWER(*str);
+		*str = tolower(*str);
 		str++;
 	}
 }
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index ed3eaa0..13c4de1 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -28,6 +28,7 @@ 
 #include <fat.h>
 #include <asm/byteorder.h>
 #include <part.h>
+#include <linux/ctype.h>
 #include "fat.c"
 
 static void uppercase(char *str, int len)
@@ -35,7 +36,7 @@  static void uppercase(char *str, int len)
 	int i;
 
 	for (i = 0; i < len; i++) {
-		TOUPPER(*str);
+		*str = toupper(*str);
 		str++;
 	}
 }
diff --git a/include/fat.h b/include/fat.h
index 706cd7a..b28c3fd 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -98,9 +98,6 @@ 
 #endif
 #endif
 
-#define TOLOWER(c)	if((c) >= 'A' && (c) <= 'Z'){(c)+=('a' - 'A');}
-#define TOUPPER(c)	if ((c) >= 'a' && (c) <= 'z') \
-				(c) -= ('a' - 'A');
 #define START(dent)	(FAT2CPU16((dent)->start) \
 			+ (mydata->fatsize != 32 ? 0 : \
 			  (FAT2CPU16((dent)->starthi) << 16)))