Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/trim.c


Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/libbb/trim.c

    r1765 r2725  
    66 * If you wrote this, please acknowledge your work.
    77 *
    8  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    99 */
    1010
    1111#include "libbb.h"
    1212
    13 void trim(char *s)
     13void FAST_FUNC trim(char *s)
    1414{
    1515    size_t len = strlen(s);
    16     size_t lws;
    1716
    1817    /* trim trailing whitespace */
    19     while (len && isspace(s[len-1])) --len;
     18    while (len && isspace(s[len-1]))
     19        --len;
    2020
    2121    /* trim leading whitespace */
    2222    if (len) {
    23         lws = strspn(s, " \n\r\t\v");
    24         memmove(s, s + lws, len -= lws);
     23        char *nws = skip_whitespace(s);
     24        if ((nws - s) != 0) {
     25            len -= (nws - s);
     26            memmove(s, nws, len);
     27        }
    2528    }
    2629    s[len] = '\0';
Note: See TracChangeset for help on using the changeset viewer.