s/extern inline/static ATTRIBUTE_ALWAYS_INLINE/g

xstrtou: disallow leading '+'
This commit is contained in:
Denis Vlasenko 2006-12-16 23:48:13 +00:00
parent 3469c185e5
commit a597aaddfa
8 changed files with 41 additions and 42 deletions

View File

@ -87,7 +87,7 @@ int ar_main(int argc, char **argv)
}
archive_handle->offset += 7;
while (get_header_ar(archive_handle) == EXIT_SUCCESS);
while (get_header_ar(archive_handle) == EXIT_SUCCESS) /* repeat */;
return EXIT_SUCCESS;
}

View File

@ -195,7 +195,7 @@ typedef unsigned long long int uintmax_t;
* out of the tree, so stop saying it should be. */
#define fdprintf dprintf
/* Don't use lchown with glibc older then 2.1.x ... uC-libc lacks it */
/* Don't use lchown with glibc older than 2.1.x ... uC-libc lacks it */
#if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \
defined __UC_LIBC__
# define lchown chown

View File

@ -29,50 +29,50 @@ type xato##T(const char *str); \
DECLARE_STR_CONV(long long, ll, ull)
/* Provides extern inline definitions of functions */
/* Provides inline definitions of functions */
/* (useful for mapping them to the type of the same width) */
#define DEFINE_EQUIV_STR_CONV(narrow, N, W, UN, UW) \
\
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xstrto##UN##_range_sfx(const char *str, int b, unsigned narrow l, unsigned narrow u, const struct suffix_mult *sfx) \
{ return xstrto##UW##_range_sfx(str, b, l, u, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xstrto##UN##_range(const char *str, int b, unsigned narrow l, unsigned narrow u) \
{ return xstrto##UW##_range(str, b, l, u); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xstrto##UN##_sfx(const char *str, int b, const struct suffix_mult *sfx) \
{ return xstrto##UW##_sfx(str, b, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xstrto##UN(const char *str, int b) \
{ return xstrto##UW(str, b); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xato##UN##_range_sfx(const char *str, unsigned narrow l, unsigned narrow u, const struct suffix_mult *sfx) \
{ return xato##UW##_range_sfx(str, l, u, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xato##UN##_range(const char *str, unsigned narrow l, unsigned narrow u) \
{ return xato##UW##_range(str, l, u); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xato##UN##_sfx(const char *str, const struct suffix_mult *sfx) \
{ return xato##UW##_sfx(str, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
unsigned narrow xato##UN(const char *str) \
{ return xato##UW(str); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
narrow xstrto##N##_range_sfx(const char *str, int b, narrow l, narrow u, const struct suffix_mult *sfx) \
{ return xstrto##W##_range_sfx(str, b, l, u, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
narrow xstrto##N##_range(const char *str, int b, narrow l, narrow u) \
{ return xstrto##W##_range(str, b, l, u); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
narrow xato##N##_range_sfx(const char *str, narrow l, narrow u, const struct suffix_mult *sfx) \
{ return xato##W##_range_sfx(str, l, u, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
narrow xato##N##_range(const char *str, narrow l, narrow u) \
{ return xato##W##_range(str, l, u); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
narrow xato##N##_sfx(const char *str, const struct suffix_mult *sfx) \
{ return xato##W##_sfx(str, sfx); } \
extern inline \
static ATTRIBUTE_ALWAYS_INLINE \
narrow xato##N(const char *str) \
{ return xato##W(str); } \
@ -96,7 +96,7 @@ DECLARE_STR_CONV(int, i, u)
/* Specialized */
int BUG_xatou32_unimplemented(void);
extern inline uint32_t xatou32(const char *numstr)
static ATTRIBUTE_ALWAYS_INLINE uint32_t xatou32(const char *numstr)
{
if (UINT_MAX == 0xffffffff)
return xatou(numstr);
@ -111,11 +111,11 @@ unsigned long long bb_strtoull(const char *arg, char **endp, int base);
long long bb_strtoll(const char *arg, char **endp, int base);
#if ULONG_MAX == ULLONG_MAX
extern inline
static ATTRIBUTE_ALWAYS_INLINE
unsigned long bb_strtoul(const char *arg, char **endp, int base)
{ return bb_strtoull(arg, endp, base); }
extern inline
unsigned long bb_strtol(const char *arg, char **endp, int base)
static ATTRIBUTE_ALWAYS_INLINE
long bb_strtol(const char *arg, char **endp, int base)
{ return bb_strtoll(arg, endp, base); }
#else
unsigned long bb_strtoul(const char *arg, char **endp, int base);
@ -123,26 +123,26 @@ long bb_strtol(const char *arg, char **endp, int base);
#endif
#if UINT_MAX == ULLONG_MAX
extern inline
unsigned long bb_strtou(const char *arg, char **endp, int base)
static ATTRIBUTE_ALWAYS_INLINE
unsigned bb_strtou(const char *arg, char **endp, int base)
{ return bb_strtoull(arg, endp, base); }
extern inline
unsigned long bb_strtoi(const char *arg, char **endp, int base)
static ATTRIBUTE_ALWAYS_INLINE
int bb_strtoi(const char *arg, char **endp, int base)
{ return bb_strtoll(arg, endp, base); }
#elif UINT_MAX == ULONG_MAX
extern inline
unsigned long bb_strtou(const char *arg, char **endp, int base)
static ATTRIBUTE_ALWAYS_INLINE
unsigned bb_strtou(const char *arg, char **endp, int base)
{ return bb_strtoul(arg, endp, base); }
extern inline
unsigned long bb_strtoi(const char *arg, char **endp, int base)
static ATTRIBUTE_ALWAYS_INLINE
int bb_strtoi(const char *arg, char **endp, int base)
{ return bb_strtol(arg, endp, base); }
#else
unsigned long bb_strtou(const char *arg, char **endp, int base);
long bb_strtoi(const char *arg, char **endp, int base);
unsigned bb_strtou(const char *arg, char **endp, int base);
int bb_strtoi(const char *arg, char **endp, int base);
#endif
int BUG_bb_strtou32_unimplemented(void);
extern inline
static ATTRIBUTE_ALWAYS_INLINE
uint32_t bb_strtou32(const char *arg, char **endp, int base)
{
if (sizeof(uint32_t) == sizeof(unsigned))

View File

@ -447,7 +447,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...)
}
va_end (p);
#if ENABLE_AR || ENABLE_TAR
if (spec_flgs & FIRST_ARGV_IS_OPT) {
if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') {
argv[1] = xasprintf("-%s", argv[1]);
@ -455,7 +454,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...)
spec_flgs |= FREE_FIRST_ARGV_IS_OPT;
}
}
#endif
/* Note: just "getopt() <= 0" will not work good for
* "fake" short options, like this one:
* wget $'-\203' "Test: test" http://kernel.org/

View File

@ -34,7 +34,8 @@
#endif
#if UINT_MAX != ULONG_MAX
extern inline unsigned bb_strtoui(const char *str, char **end, int b)
static ATTRIBUTE_ALWAYS_INLINE
unsigned bb_strtoui(const char *str, char **end, int b)
{
unsigned long v = strtoul(str, end, b);
if (v > UINT_MAX) {

View File

@ -24,7 +24,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base,
/* Disallow '-' and any leading whitespace. Speed isn't critical here
* since we're parsing commandline args. So make sure we get the
* actual isspace function rather than a lnumstrer macro implementaion. */
if ((*numstr == '-') || (isspace)(*numstr))
if (*numstr == '-' || *numstr == '+' || (isspace)(*numstr))
goto inval;
/* Since this is a lib function, we're not allowed to reset errno to 0.
@ -36,7 +36,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base,
/* Do the initial validity check. Note: The standards do not
* guarantee that errno is set if no digits were found. So we
* must test for this explicitly. */
if (errno || (numstr == e))
if (errno || numstr == e)
goto inval; /* error / no digits / illegal trailing chars */
errno = old_errno; /* Ok. So restore errno. */
@ -127,7 +127,7 @@ type xstrto(_range_sfx)(const char *numstr, int base,
type r;
const char *p = numstr;
if ((p[0] == '-') && (p[1] != '+')) {
if (p[0] == '-') {
++p;
++u; /* two's complement */
}

View File

@ -252,14 +252,14 @@ set_all_unchanged(void)
ptes[i].changed = 0;
}
extern inline void
static ATTRIBUTE_ALWAYS_INLINE void
set_changed(int i)
{
ptes[i].changed = 1;
}
#endif /* CONFIG_FEATURE_FDISK_WRITABLE */
extern inline struct partition *
static ATTRIBUTE_ALWAYS_INLINE struct partition *
get_part_table(int i)
{
return ptes[i].part_table;
@ -281,7 +281,7 @@ valid_part_table_flag(const char *mbuffer)
}
#if ENABLE_FEATURE_FDISK_WRITABLE
extern inline void
static ATTRIBUTE_ALWAYS_INLINE void
write_part_table_flag(char *b)
{
b[510] = 0x55;

View File

@ -183,7 +183,7 @@ static int used_good_blocks;
static unsigned short good_blocks_table[MAX_GOOD_BLOCKS];
static unsigned long req_nr_inodes;
extern inline unsigned div_roundup(unsigned size, unsigned n)
static ATTRIBUTE_ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n)
{
return (size + n-1) / n;
}