aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-16 23:48:13 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-16 23:48:13 +0000
commita597aaddfa76d589d3e1a37b1f1c3401c2decffd (patch)
tree1db4966ffc99ad3c495bd18d6f7040e1515e79d7
parent3469c185e50e7bb672ce33ab5e50da753f0f0e20 (diff)
downloadbusybox-a597aaddfa76d589d3e1a37b1f1c3401c2decffd.tar.gz
s/extern inline/static ATTRIBUTE_ALWAYS_INLINE/g
xstrtou: disallow leading '+'
-rw-r--r--archival/ar.c2
-rw-r--r--include/platform.h2
-rw-r--r--include/xatonum.h60
-rw-r--r--libbb/getopt32.c2
-rw-r--r--libbb/xatonum.c3
-rw-r--r--libbb/xatonum_template.c6
-rw-r--r--util-linux/fdisk.c6
-rw-r--r--util-linux/mkfs_minix.c2
8 files changed, 41 insertions, 42 deletions
diff --git a/archival/ar.c b/archival/ar.c
index 521e03799..4bcf6946f 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -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;
}
diff --git a/include/platform.h b/include/platform.h
index 345e9cb7a..a1ec17a7b 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -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
diff --git a/include/xatonum.h b/include/xatonum.h
index 585d84623..cf088a49e 100644
--- a/include/xatonum.h
+++ b/include/xatonum.h
@@ -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))
diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index dddf8121a..50343fdab 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -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/
diff --git a/libbb/xatonum.c b/libbb/xatonum.c
index 35607c317..dec3c2dc4 100644
--- a/libbb/xatonum.c
+++ b/libbb/xatonum.c
@@ -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) {
diff --git a/libbb/xatonum_template.c b/libbb/xatonum_template.c
index 53ba544eb..ce0199594 100644
--- a/libbb/xatonum_template.c
+++ b/libbb/xatonum_template.c
@@ -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 */
}
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 2f87f1c60..2af5a41b9 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -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;
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index af19da68c..263013af9 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -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;
}