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/xatonum_template.c

    r1765 r2725  
     1/*
     2 *
     3 * Licensed under GPLv2, see file LICENSE in this source tree.
     4 */
    15/*
    26You need to define the following (example):
     
    1317*/
    1418
    15 unsigned type xstrtou(_range_sfx)(const char *numstr, int base,
     19unsigned type FAST_FUNC xstrtou(_range_sfx)(const char *numstr, int base,
    1620        unsigned type lower,
    1721        unsigned type upper,
     
    2226    char *e;
    2327
    24     /* Disallow '-' and any leading whitespace.  Speed isn't critical here
    25      * since we're parsing commandline args.  So make sure we get the
    26      * actual isspace function rather than a lnumstrer macro implementaion. */
    27     if (*numstr == '-' || *numstr == '+' || (isspace)(*numstr))
     28    /* Disallow '-' and any leading whitespace. */
     29    if (*numstr == '-' || *numstr == '+' || isspace(*numstr))
    2830        goto inval;
    2931
     
    4042        goto inval; /* error / no digits / illegal trailing chars */
    4143
    42     errno = old_errno;  /* Ok.  So restore errno. */
     44    errno = old_errno;  /* Ok.  So restore errno. */
    4345
    4446    /* Do optional suffix parsing.  Allow 'empty' suffix tables.
     
    7375}
    7476
    75 unsigned type xstrtou(_range)(const char *numstr, int base,
     77unsigned type FAST_FUNC xstrtou(_range)(const char *numstr, int base,
    7678        unsigned type lower,
    7779        unsigned type upper)
     
    8082}
    8183
    82 unsigned type xstrtou(_sfx)(const char *numstr, int base,
     84unsigned type FAST_FUNC xstrtou(_sfx)(const char *numstr, int base,
    8385        const struct suffix_mult *suffixes)
    8486{
     
    8688}
    8789
    88 unsigned type xstrtou()(const char *numstr, int base)
     90unsigned type FAST_FUNC xstrtou()(const char *numstr, int base)
    8991{
    9092    return xstrtou(_range_sfx)(numstr, base, 0, XSTR_UTYPE_MAX, NULL);
    9193}
    9294
    93 unsigned type xatou(_range_sfx)(const char *numstr,
     95unsigned type FAST_FUNC xatou(_range_sfx)(const char *numstr,
    9496        unsigned type lower,
    9597        unsigned type upper,
     
    99101}
    100102
    101 unsigned type xatou(_range)(const char *numstr,
     103unsigned type FAST_FUNC xatou(_range)(const char *numstr,
    102104        unsigned type lower,
    103105        unsigned type upper)
     
    106108}
    107109
    108 unsigned type xatou(_sfx)(const char *numstr,
     110unsigned type FAST_FUNC xatou(_sfx)(const char *numstr,
    109111        const struct suffix_mult *suffixes)
    110112{
     
    112114}
    113115
    114 unsigned type xatou()(const char *numstr)
     116unsigned type FAST_FUNC xatou()(const char *numstr)
    115117{
    116118    return xatou(_sfx)(numstr, NULL);
     
    119121/* Signed ones */
    120122
    121 type xstrto(_range_sfx)(const char *numstr, int base,
     123type FAST_FUNC xstrto(_range_sfx)(const char *numstr, int base,
    122124        type lower,
    123125        type upper,
     
    128130    const char *p = numstr;
    129131
    130     if (p[0] == '-') {
     132    /* NB: if you'll decide to disallow '+':
     133     * at least renice applet needs to allow it */
     134    if (p[0] == '+' || p[0] == '-') {
    131135        ++p;
    132         ++u;    /* two's complement */
     136        if (p[0] == '-')
     137            ++u; /* = <type>_MIN (01111... + 1 == 10000...) */
    133138    }
    134139
     
    147152}
    148153
    149 type xstrto(_range)(const char *numstr, int base, type lower, type upper)
     154type FAST_FUNC xstrto(_range)(const char *numstr, int base, type lower, type upper)
    150155{
    151156    return xstrto(_range_sfx)(numstr, base, lower, upper, NULL);
    152157}
    153158
    154 type xato(_range_sfx)(const char *numstr,
     159type FAST_FUNC xstrto()(const char *numstr, int base)
     160{
     161    return xstrto(_range_sfx)(numstr, base, XSTR_TYPE_MIN, XSTR_TYPE_MAX, NULL);
     162}
     163
     164type FAST_FUNC xato(_range_sfx)(const char *numstr,
    155165        type lower,
    156166        type upper,
     
    160170}
    161171
    162 type xato(_range)(const char *numstr, type lower, type upper)
     172type FAST_FUNC xato(_range)(const char *numstr, type lower, type upper)
    163173{
    164174    return xstrto(_range_sfx)(numstr, 10, lower, upper, NULL);
    165175}
    166176
    167 type xato(_sfx)(const char *numstr, const struct suffix_mult *suffixes)
     177type FAST_FUNC xato(_sfx)(const char *numstr, const struct suffix_mult *suffixes)
    168178{
    169179    return xstrto(_range_sfx)(numstr, 10, XSTR_TYPE_MIN, XSTR_TYPE_MAX, suffixes);
    170180}
    171181
    172 type xato()(const char *numstr)
     182type FAST_FUNC xato()(const char *numstr)
    173183{
    174184    return xstrto(_range_sfx)(numstr, 10, XSTR_TYPE_MIN, XSTR_TYPE_MAX, NULL);
Note: See TracChangeset for help on using the changeset viewer.