Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/libbb/trim.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 13  Line 13 
13  void FAST_FUNC trim(char *s)  void FAST_FUNC trim(char *s)
14  {  {
15   size_t len = strlen(s);   size_t len = strlen(s);
  size_t lws;  
16    
17   /* trim trailing whitespace */   /* trim trailing whitespace */
18   while (len && isspace(s[len-1]))   while (len && isspace(s[len-1]))
# Line 21  void FAST_FUNC trim(char *s) Line 20  void FAST_FUNC trim(char *s)
20    
21   /* trim leading whitespace */   /* trim leading whitespace */
22   if (len) {   if (len) {
23   lws = strspn(s, " \n\r\t\v");   char *nws = skip_whitespace(s);
24   if (lws) {   if ((nws - s) != 0) {
25   len -= lws;   len -= (nws - s);
26   memmove(s, s + lws, len);   memmove(s, nws, len);
27   }   }
28   }   }
29   s[len] = '\0';   s[len] = '\0';

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