Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/libbb/skip_whitespace.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 11  Line 11 
11    
12  char* FAST_FUNC skip_whitespace(const char *s)  char* FAST_FUNC skip_whitespace(const char *s)
13  {  {
14   /* NB: isspace('\0') returns 0 */   /* In POSIX/C locale (the only locale we care about: do we REALLY want
15   while (isspace(*s)) ++s;   * to allow Unicode whitespace in, say, .conf files? nuts!)
16     * isspace is only these chars: "\t\n\v\f\r" and space.
17     * "\t\n\v\f\r" happen to have ASCII codes 9,10,11,12,13.
18     * Use that.
19     */
20     while (*s == ' ' || (unsigned char)(*s - 9) <= (13 - 9))
21     s++;
22    
23   return (char *) s;   return (char *) s;
24  }  }
25    
26  char* FAST_FUNC skip_non_whitespace(const char *s)  char* FAST_FUNC skip_non_whitespace(const char *s)
27  {  {
28   while (*s && !isspace(*s)) ++s;   while (*s != '\0' && *s != ' ' && (unsigned char)(*s - 9) > (13 - 9))
29     s++;
30    
31   return (char *) s;   return (char *) s;
32  }  }

Legend:
Removed from v.983  
changed lines
  Added in v.984