All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libblkid: Make use of isalnum()
@ 2013-02-17  1:37 Zeeshan Ali (Khattak)
  2013-02-18 11:23 ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Zeeshan Ali (Khattak) @ 2013-02-17  1:37 UTC (permalink / raw)
  To: util-linux; +Cc: Zeeshan Ali (Khattak)

From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>

---
 libblkid/src/encode.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libblkid/src/encode.c b/libblkid/src/encode.c
index ff57be4..e96e0e2 100644
--- a/libblkid/src/encode.c
+++ b/libblkid/src/encode.c
@@ -181,9 +181,7 @@ static int replace_whitespace(const char *str, char *to, size_t len)
 
 static int is_whitelisted(char c, const char *white)
 {
-	if ((c >= '0' && c <= '9') ||
-	    (c >= 'A' && c <= 'Z') ||
-	    (c >= 'a' && c <= 'z') ||
+	if (isalnum (c) ||
 	    strchr("#+-.:=@_", c) != NULL ||
 	    (white != NULL && strchr(white, c) != NULL))
 		return 1;
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libblkid: Make use of isalnum()
  2013-02-17  1:37 [PATCH] libblkid: Make use of isalnum() Zeeshan Ali (Khattak)
@ 2013-02-18 11:23 ` Karel Zak
  2013-02-18 13:35   ` Zeeshan Ali (Khattak)
  0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2013-02-18 11:23 UTC (permalink / raw)
  To: Zeeshan Ali (Khattak); +Cc: util-linux

On Sun, Feb 17, 2013 at 03:37:32AM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
> 
> ---
>  libblkid/src/encode.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libblkid/src/encode.c b/libblkid/src/encode.c
> index ff57be4..e96e0e2 100644
> --- a/libblkid/src/encode.c
> +++ b/libblkid/src/encode.c
> @@ -181,9 +181,7 @@ static int replace_whitespace(const char *str, char *to, size_t len)
>  
>  static int is_whitelisted(char c, const char *white)
>  {
> -	if ((c >= '0' && c <= '9') ||
> -	    (c >= 'A' && c <= 'Z') ||
> -	    (c >= 'a' && c <= 'z') ||
> +	if (isalnum (c) ||

 It seems like locale sensitive function ;-)

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libblkid: Make use of isalnum()
  2013-02-18 11:23 ` Karel Zak
@ 2013-02-18 13:35   ` Zeeshan Ali (Khattak)
  0 siblings, 0 replies; 3+ messages in thread
From: Zeeshan Ali (Khattak) @ 2013-02-18 13:35 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

On Mon, Feb 18, 2013 at 1:23 PM, Karel Zak <kzak@redhat.com> wrote:
> On Sun, Feb 17, 2013 at 03:37:32AM +0200, Zeeshan Ali (Khattak) wrote:
>> From: "Zeeshan Ali (Khattak)" <zeeshanak@gnome.org>
>>
>> ---
>>  libblkid/src/encode.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/libblkid/src/encode.c b/libblkid/src/encode.c
>> index ff57be4..e96e0e2 100644
>> --- a/libblkid/src/encode.c
>> +++ b/libblkid/src/encode.c
>> @@ -181,9 +181,7 @@ static int replace_whitespace(const char *str, char *to, size_t len)
>>
>>  static int is_whitelisted(char c, const char *white)
>>  {
>> -     if ((c >= '0' && c <= '9') ||
>> -         (c >= 'A' && c <= 'Z') ||
>> -         (c >= 'a' && c <= 'z') ||
>> +     if (isalnum (c) ||
>
>  It seems like locale sensitive function ;-)

Ouch, didn't think of locale. :(

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-18 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-17  1:37 [PATCH] libblkid: Make use of isalnum() Zeeshan Ali (Khattak)
2013-02-18 11:23 ` Karel Zak
2013-02-18 13:35   ` Zeeshan Ali (Khattak)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.