Re: [RFC] A need for "yesno"-function? (and "cleanup" of kernel.h) (was: Re: [KJ] [RFC] A need for a "yesno"-function?)

2007-03-16 Thread Jan Engelhardt

On Mar 16 2007 16:24, Richard Knutsson wrote:
>> > 
>> > char yesno_chr(const bool value)
>> > {
>> >return "ny"[value];
>> > }
>> > 
>> > char *yesno_str(const bool value)
>> > {
>> >return &"no\0yes"[3 * value];
>> > }

static/extern const char *const yesno[] = {"no", "yes"};
static inline const char *yesno_str(bool value)
{
return yesno[value];
}
#or
#define yesno_str(value) yesno[!!(value)]

>> > Thoughts?


Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] A need for "yesno"-function? (and "cleanup" of kernel.h) (was: Re: [KJ] [RFC] A need for a "yesno"-function?)

2007-03-16 Thread Richard Knutsson

Bernd Petrovitsch wrote:

On Fri, 2007-03-16 at 16:24 +0100, Richard Knutsson wrote:
[...]
  
more readable). The big problem is, where to put it? Seems wrong to put 
in  since it appear to be a replica of userspace's 
 (otherwise, why put mem*-functions in there?).



memcpy(3) and memcmp(3) are also there in user-space.
  
Did I miss something or did you just restate what was stated? (If it was 
not a replica, I think the mem*-functions would be better placed in 
memory.h, or such)


Richard Knutsson

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] A need for "yesno"-function? (and "cleanup" of kernel.h) (was: Re: [KJ] [RFC] A need for a "yesno"-function?)

2007-03-16 Thread Bernd Petrovitsch
On Fri, 2007-03-16 at 16:24 +0100, Richard Knutsson wrote:
[...]
> more readable). The big problem is, where to put it? Seems wrong to put 
> in  since it appear to be a replica of userspace's 
>  (otherwise, why put mem*-functions in there?).

memcpy(3) and memcmp(3) are also there in user-space.

Bernd
-- 
Firmix Software GmbH   http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
  Embedded Linux Development and Services

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] A need for yesno-function? (and cleanup of kernel.h) (was: Re: [KJ] [RFC] A need for a yesno-function?)

2007-03-16 Thread Bernd Petrovitsch
On Fri, 2007-03-16 at 16:24 +0100, Richard Knutsson wrote:
[...]
 more readable). The big problem is, where to put it? Seems wrong to put 
 in linux/string.h since it appear to be a replica of userspace's 
 string.h (otherwise, why put mem*-functions in there?).

memcpy(3) and memcmp(3) are also there in user-space.

Bernd
-- 
Firmix Software GmbH   http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
  Embedded Linux Development and Services

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] A need for yesno-function? (and cleanup of kernel.h) (was: Re: [KJ] [RFC] A need for a yesno-function?)

2007-03-16 Thread Richard Knutsson

Bernd Petrovitsch wrote:

On Fri, 2007-03-16 at 16:24 +0100, Richard Knutsson wrote:
[...]
  
more readable). The big problem is, where to put it? Seems wrong to put 
in linux/string.h since it appear to be a replica of userspace's 
string.h (otherwise, why put mem*-functions in there?).



memcpy(3) and memcmp(3) are also there in user-space.
  
Did I miss something or did you just restate what was stated? (If it was 
not a replica, I think the mem*-functions would be better placed in 
memory.h, or such)


Richard Knutsson

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] A need for yesno-function? (and cleanup of kernel.h) (was: Re: [KJ] [RFC] A need for a yesno-function?)

2007-03-16 Thread Jan Engelhardt

On Mar 16 2007 16:24, Richard Knutsson wrote:
  
  char yesno_chr(const bool value)
  {
 return ny[value];
  }
  
  char *yesno_str(const bool value)
  {
 return no\0yes[3 * value];
  }

static/extern const char *const yesno[] = {no, yes};
static inline const char *yesno_str(bool value)
{
return yesno[value];
}
#or
#define yesno_str(value) yesno[!!(value)]

  Thoughts?


Jan
-- 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/