diff options
author | André Goddard Rosa <andre.goddard@gmail.com> | 2009-12-14 18:01:04 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 08:53:32 -0800 |
commit | f653398c86a1c104f0992bd788dd4bb065449be4 (patch) | |
tree | 69cd79aaca48c2e1bdf9a48b968772347dbd5df2 /drivers/hwmon/max6650.c | |
parent | 4e62b0930223fe2f61094ceb1bbb31b3fe4251c2 (diff) |
string: factorize skip_spaces and export it to be generally available
On the following sentence:
while (*s && isspace(*s))
s++;
If *s == 0, isspace() evaluates to ((_ctype[*s] & 0x20) != 0), which
evaluates to ((0x08 & 0x20) != 0) which equals to 0 as well.
If *s == 1, we depend on isspace() result anyway. In other words,
"a char equals zero is never a space", so remove this check.
Also, *s != 0 is most common case (non-null string).
Fixed const return as noticed by Jan Engelhardt and James Bottomley.
Fixed unnecessary extra cast on strstrip() as noticed by Jan Engelhardt.
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/hwmon/max6650.c')
0 files changed, 0 insertions, 0 deletions