diff options
| author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-16 23:48:13 +0000 |
|---|---|---|
| committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-12-16 23:48:13 +0000 |
| commit | b0ba03e9b3d460154fd09ef5676c18bf0770fdce (patch) | |
| tree | 1db4966ffc99ad3c495bd18d6f7040e1515e79d7 | |
| parent | 13fadcb7fbac1e7b95cf2de2dff28b2d547a40c1 (diff) | |
| download | busybox-w32-b0ba03e9b3d460154fd09ef5676c18bf0770fdce.tar.gz busybox-w32-b0ba03e9b3d460154fd09ef5676c18bf0770fdce.tar.bz2 busybox-w32-b0ba03e9b3d460154fd09ef5676c18bf0770fdce.zip | |
s/extern inline/static ATTRIBUTE_ALWAYS_INLINE/g
xstrtou: disallow leading '+'
git-svn-id: svn://busybox.net/trunk/busybox@16976 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | archival/ar.c | 2 | ||||
| -rw-r--r-- | include/platform.h | 2 | ||||
| -rw-r--r-- | include/xatonum.h | 60 | ||||
| -rw-r--r-- | libbb/getopt32.c | 2 | ||||
| -rw-r--r-- | libbb/xatonum.c | 3 | ||||
| -rw-r--r-- | libbb/xatonum_template.c | 6 | ||||
| -rw-r--r-- | util-linux/fdisk.c | 6 | ||||
| -rw-r--r-- | util-linux/mkfs_minix.c | 2 |
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) | |||
| 87 | } | 87 | } |
| 88 | archive_handle->offset += 7; | 88 | archive_handle->offset += 7; |
| 89 | 89 | ||
| 90 | while (get_header_ar(archive_handle) == EXIT_SUCCESS); | 90 | while (get_header_ar(archive_handle) == EXIT_SUCCESS) /* repeat */; |
| 91 | 91 | ||
| 92 | return EXIT_SUCCESS; | 92 | return EXIT_SUCCESS; |
| 93 | } | 93 | } |
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; | |||
| 195 | * out of the tree, so stop saying it should be. */ | 195 | * out of the tree, so stop saying it should be. */ |
| 196 | #define fdprintf dprintf | 196 | #define fdprintf dprintf |
| 197 | 197 | ||
| 198 | /* Don't use lchown with glibc older then 2.1.x ... uC-libc lacks it */ | 198 | /* Don't use lchown with glibc older than 2.1.x ... uC-libc lacks it */ |
| 199 | #if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \ | 199 | #if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \ |
| 200 | defined __UC_LIBC__ | 200 | defined __UC_LIBC__ |
| 201 | # define lchown chown | 201 | # 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); \ | |||
| 29 | DECLARE_STR_CONV(long long, ll, ull) | 29 | DECLARE_STR_CONV(long long, ll, ull) |
| 30 | 30 | ||
| 31 | 31 | ||
| 32 | /* Provides extern inline definitions of functions */ | 32 | /* Provides inline definitions of functions */ |
| 33 | /* (useful for mapping them to the type of the same width) */ | 33 | /* (useful for mapping them to the type of the same width) */ |
| 34 | #define DEFINE_EQUIV_STR_CONV(narrow, N, W, UN, UW) \ | 34 | #define DEFINE_EQUIV_STR_CONV(narrow, N, W, UN, UW) \ |
| 35 | \ | 35 | \ |
| 36 | extern inline \ | 36 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 37 | unsigned narrow xstrto##UN##_range_sfx(const char *str, int b, unsigned narrow l, unsigned narrow u, const struct suffix_mult *sfx) \ | 37 | unsigned narrow xstrto##UN##_range_sfx(const char *str, int b, unsigned narrow l, unsigned narrow u, const struct suffix_mult *sfx) \ |
| 38 | { return xstrto##UW##_range_sfx(str, b, l, u, sfx); } \ | 38 | { return xstrto##UW##_range_sfx(str, b, l, u, sfx); } \ |
| 39 | extern inline \ | 39 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 40 | unsigned narrow xstrto##UN##_range(const char *str, int b, unsigned narrow l, unsigned narrow u) \ | 40 | unsigned narrow xstrto##UN##_range(const char *str, int b, unsigned narrow l, unsigned narrow u) \ |
| 41 | { return xstrto##UW##_range(str, b, l, u); } \ | 41 | { return xstrto##UW##_range(str, b, l, u); } \ |
| 42 | extern inline \ | 42 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 43 | unsigned narrow xstrto##UN##_sfx(const char *str, int b, const struct suffix_mult *sfx) \ | 43 | unsigned narrow xstrto##UN##_sfx(const char *str, int b, const struct suffix_mult *sfx) \ |
| 44 | { return xstrto##UW##_sfx(str, b, sfx); } \ | 44 | { return xstrto##UW##_sfx(str, b, sfx); } \ |
| 45 | extern inline \ | 45 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 46 | unsigned narrow xstrto##UN(const char *str, int b) \ | 46 | unsigned narrow xstrto##UN(const char *str, int b) \ |
| 47 | { return xstrto##UW(str, b); } \ | 47 | { return xstrto##UW(str, b); } \ |
| 48 | extern inline \ | 48 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 49 | unsigned narrow xato##UN##_range_sfx(const char *str, unsigned narrow l, unsigned narrow u, const struct suffix_mult *sfx) \ | 49 | unsigned narrow xato##UN##_range_sfx(const char *str, unsigned narrow l, unsigned narrow u, const struct suffix_mult *sfx) \ |
| 50 | { return xato##UW##_range_sfx(str, l, u, sfx); } \ | 50 | { return xato##UW##_range_sfx(str, l, u, sfx); } \ |
| 51 | extern inline \ | 51 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 52 | unsigned narrow xato##UN##_range(const char *str, unsigned narrow l, unsigned narrow u) \ | 52 | unsigned narrow xato##UN##_range(const char *str, unsigned narrow l, unsigned narrow u) \ |
| 53 | { return xato##UW##_range(str, l, u); } \ | 53 | { return xato##UW##_range(str, l, u); } \ |
| 54 | extern inline \ | 54 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 55 | unsigned narrow xato##UN##_sfx(const char *str, const struct suffix_mult *sfx) \ | 55 | unsigned narrow xato##UN##_sfx(const char *str, const struct suffix_mult *sfx) \ |
| 56 | { return xato##UW##_sfx(str, sfx); } \ | 56 | { return xato##UW##_sfx(str, sfx); } \ |
| 57 | extern inline \ | 57 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 58 | unsigned narrow xato##UN(const char *str) \ | 58 | unsigned narrow xato##UN(const char *str) \ |
| 59 | { return xato##UW(str); } \ | 59 | { return xato##UW(str); } \ |
| 60 | extern inline \ | 60 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 61 | narrow xstrto##N##_range_sfx(const char *str, int b, narrow l, narrow u, const struct suffix_mult *sfx) \ | 61 | narrow xstrto##N##_range_sfx(const char *str, int b, narrow l, narrow u, const struct suffix_mult *sfx) \ |
| 62 | { return xstrto##W##_range_sfx(str, b, l, u, sfx); } \ | 62 | { return xstrto##W##_range_sfx(str, b, l, u, sfx); } \ |
| 63 | extern inline \ | 63 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 64 | narrow xstrto##N##_range(const char *str, int b, narrow l, narrow u) \ | 64 | narrow xstrto##N##_range(const char *str, int b, narrow l, narrow u) \ |
| 65 | { return xstrto##W##_range(str, b, l, u); } \ | 65 | { return xstrto##W##_range(str, b, l, u); } \ |
| 66 | extern inline \ | 66 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 67 | narrow xato##N##_range_sfx(const char *str, narrow l, narrow u, const struct suffix_mult *sfx) \ | 67 | narrow xato##N##_range_sfx(const char *str, narrow l, narrow u, const struct suffix_mult *sfx) \ |
| 68 | { return xato##W##_range_sfx(str, l, u, sfx); } \ | 68 | { return xato##W##_range_sfx(str, l, u, sfx); } \ |
| 69 | extern inline \ | 69 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 70 | narrow xato##N##_range(const char *str, narrow l, narrow u) \ | 70 | narrow xato##N##_range(const char *str, narrow l, narrow u) \ |
| 71 | { return xato##W##_range(str, l, u); } \ | 71 | { return xato##W##_range(str, l, u); } \ |
| 72 | extern inline \ | 72 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 73 | narrow xato##N##_sfx(const char *str, const struct suffix_mult *sfx) \ | 73 | narrow xato##N##_sfx(const char *str, const struct suffix_mult *sfx) \ |
| 74 | { return xato##W##_sfx(str, sfx); } \ | 74 | { return xato##W##_sfx(str, sfx); } \ |
| 75 | extern inline \ | 75 | static ATTRIBUTE_ALWAYS_INLINE \ |
| 76 | narrow xato##N(const char *str) \ | 76 | narrow xato##N(const char *str) \ |
| 77 | { return xato##W(str); } \ | 77 | { return xato##W(str); } \ |
| 78 | 78 | ||
| @@ -96,7 +96,7 @@ DECLARE_STR_CONV(int, i, u) | |||
| 96 | /* Specialized */ | 96 | /* Specialized */ |
| 97 | 97 | ||
| 98 | int BUG_xatou32_unimplemented(void); | 98 | int BUG_xatou32_unimplemented(void); |
| 99 | extern inline uint32_t xatou32(const char *numstr) | 99 | static ATTRIBUTE_ALWAYS_INLINE uint32_t xatou32(const char *numstr) |
| 100 | { | 100 | { |
| 101 | if (UINT_MAX == 0xffffffff) | 101 | if (UINT_MAX == 0xffffffff) |
| 102 | return xatou(numstr); | 102 | return xatou(numstr); |
| @@ -111,11 +111,11 @@ unsigned long long bb_strtoull(const char *arg, char **endp, int base); | |||
| 111 | long long bb_strtoll(const char *arg, char **endp, int base); | 111 | long long bb_strtoll(const char *arg, char **endp, int base); |
| 112 | 112 | ||
| 113 | #if ULONG_MAX == ULLONG_MAX | 113 | #if ULONG_MAX == ULLONG_MAX |
| 114 | extern inline | 114 | static ATTRIBUTE_ALWAYS_INLINE |
| 115 | unsigned long bb_strtoul(const char *arg, char **endp, int base) | 115 | unsigned long bb_strtoul(const char *arg, char **endp, int base) |
| 116 | { return bb_strtoull(arg, endp, base); } | 116 | { return bb_strtoull(arg, endp, base); } |
| 117 | extern inline | 117 | static ATTRIBUTE_ALWAYS_INLINE |
| 118 | unsigned long bb_strtol(const char *arg, char **endp, int base) | 118 | long bb_strtol(const char *arg, char **endp, int base) |
| 119 | { return bb_strtoll(arg, endp, base); } | 119 | { return bb_strtoll(arg, endp, base); } |
| 120 | #else | 120 | #else |
| 121 | unsigned long bb_strtoul(const char *arg, char **endp, int base); | 121 | 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); | |||
| 123 | #endif | 123 | #endif |
| 124 | 124 | ||
| 125 | #if UINT_MAX == ULLONG_MAX | 125 | #if UINT_MAX == ULLONG_MAX |
| 126 | extern inline | 126 | static ATTRIBUTE_ALWAYS_INLINE |
| 127 | unsigned long bb_strtou(const char *arg, char **endp, int base) | 127 | unsigned bb_strtou(const char *arg, char **endp, int base) |
| 128 | { return bb_strtoull(arg, endp, base); } | 128 | { return bb_strtoull(arg, endp, base); } |
| 129 | extern inline | 129 | static ATTRIBUTE_ALWAYS_INLINE |
| 130 | unsigned long bb_strtoi(const char *arg, char **endp, int base) | 130 | int bb_strtoi(const char *arg, char **endp, int base) |
| 131 | { return bb_strtoll(arg, endp, base); } | 131 | { return bb_strtoll(arg, endp, base); } |
| 132 | #elif UINT_MAX == ULONG_MAX | 132 | #elif UINT_MAX == ULONG_MAX |
| 133 | extern inline | 133 | static ATTRIBUTE_ALWAYS_INLINE |
| 134 | unsigned long bb_strtou(const char *arg, char **endp, int base) | 134 | unsigned bb_strtou(const char *arg, char **endp, int base) |
| 135 | { return bb_strtoul(arg, endp, base); } | 135 | { return bb_strtoul(arg, endp, base); } |
| 136 | extern inline | 136 | static ATTRIBUTE_ALWAYS_INLINE |
| 137 | unsigned long bb_strtoi(const char *arg, char **endp, int base) | 137 | int bb_strtoi(const char *arg, char **endp, int base) |
| 138 | { return bb_strtol(arg, endp, base); } | 138 | { return bb_strtol(arg, endp, base); } |
| 139 | #else | 139 | #else |
| 140 | unsigned long bb_strtou(const char *arg, char **endp, int base); | 140 | unsigned bb_strtou(const char *arg, char **endp, int base); |
| 141 | long bb_strtoi(const char *arg, char **endp, int base); | 141 | int bb_strtoi(const char *arg, char **endp, int base); |
| 142 | #endif | 142 | #endif |
| 143 | 143 | ||
| 144 | int BUG_bb_strtou32_unimplemented(void); | 144 | int BUG_bb_strtou32_unimplemented(void); |
| 145 | extern inline | 145 | static ATTRIBUTE_ALWAYS_INLINE |
| 146 | uint32_t bb_strtou32(const char *arg, char **endp, int base) | 146 | uint32_t bb_strtou32(const char *arg, char **endp, int base) |
| 147 | { | 147 | { |
| 148 | if (sizeof(uint32_t) == sizeof(unsigned)) | 148 | 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, ...) | |||
| 447 | } | 447 | } |
| 448 | va_end (p); | 448 | va_end (p); |
| 449 | 449 | ||
| 450 | #if ENABLE_AR || ENABLE_TAR | ||
| 451 | if (spec_flgs & FIRST_ARGV_IS_OPT) { | 450 | if (spec_flgs & FIRST_ARGV_IS_OPT) { |
| 452 | if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') { | 451 | if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') { |
| 453 | argv[1] = xasprintf("-%s", argv[1]); | 452 | argv[1] = xasprintf("-%s", argv[1]); |
| @@ -455,7 +454,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) | |||
| 455 | spec_flgs |= FREE_FIRST_ARGV_IS_OPT; | 454 | spec_flgs |= FREE_FIRST_ARGV_IS_OPT; |
| 456 | } | 455 | } |
| 457 | } | 456 | } |
| 458 | #endif | ||
| 459 | /* Note: just "getopt() <= 0" will not work good for | 457 | /* Note: just "getopt() <= 0" will not work good for |
| 460 | * "fake" short options, like this one: | 458 | * "fake" short options, like this one: |
| 461 | * wget $'-\203' "Test: test" http://kernel.org/ | 459 | * 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 @@ | |||
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #if UINT_MAX != ULONG_MAX | 36 | #if UINT_MAX != ULONG_MAX |
| 37 | extern inline unsigned bb_strtoui(const char *str, char **end, int b) | 37 | static ATTRIBUTE_ALWAYS_INLINE |
| 38 | unsigned bb_strtoui(const char *str, char **end, int b) | ||
| 38 | { | 39 | { |
| 39 | unsigned long v = strtoul(str, end, b); | 40 | unsigned long v = strtoul(str, end, b); |
| 40 | if (v > UINT_MAX) { | 41 | 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, | |||
| 24 | /* Disallow '-' and any leading whitespace. Speed isn't critical here | 24 | /* Disallow '-' and any leading whitespace. Speed isn't critical here |
| 25 | * since we're parsing commandline args. So make sure we get the | 25 | * since we're parsing commandline args. So make sure we get the |
| 26 | * actual isspace function rather than a lnumstrer macro implementaion. */ | 26 | * actual isspace function rather than a lnumstrer macro implementaion. */ |
| 27 | if ((*numstr == '-') || (isspace)(*numstr)) | 27 | if (*numstr == '-' || *numstr == '+' || (isspace)(*numstr)) |
| 28 | goto inval; | 28 | goto inval; |
| 29 | 29 | ||
| 30 | /* Since this is a lib function, we're not allowed to reset errno to 0. | 30 | /* 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, | |||
| 36 | /* Do the initial validity check. Note: The standards do not | 36 | /* Do the initial validity check. Note: The standards do not |
| 37 | * guarantee that errno is set if no digits were found. So we | 37 | * guarantee that errno is set if no digits were found. So we |
| 38 | * must test for this explicitly. */ | 38 | * must test for this explicitly. */ |
| 39 | if (errno || (numstr == e)) | 39 | if (errno || numstr == e) |
| 40 | goto inval; /* error / no digits / illegal trailing chars */ | 40 | goto inval; /* error / no digits / illegal trailing chars */ |
| 41 | 41 | ||
| 42 | errno = old_errno; /* Ok. So restore errno. */ | 42 | errno = old_errno; /* Ok. So restore errno. */ |
| @@ -127,7 +127,7 @@ type xstrto(_range_sfx)(const char *numstr, int base, | |||
| 127 | type r; | 127 | type r; |
| 128 | const char *p = numstr; | 128 | const char *p = numstr; |
| 129 | 129 | ||
| 130 | if ((p[0] == '-') && (p[1] != '+')) { | 130 | if (p[0] == '-') { |
| 131 | ++p; | 131 | ++p; |
| 132 | ++u; /* two's complement */ | 132 | ++u; /* two's complement */ |
| 133 | } | 133 | } |
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) | |||
| 252 | ptes[i].changed = 0; | 252 | ptes[i].changed = 0; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | extern inline void | 255 | static ATTRIBUTE_ALWAYS_INLINE void |
| 256 | set_changed(int i) | 256 | set_changed(int i) |
| 257 | { | 257 | { |
| 258 | ptes[i].changed = 1; | 258 | ptes[i].changed = 1; |
| 259 | } | 259 | } |
| 260 | #endif /* CONFIG_FEATURE_FDISK_WRITABLE */ | 260 | #endif /* CONFIG_FEATURE_FDISK_WRITABLE */ |
| 261 | 261 | ||
| 262 | extern inline struct partition * | 262 | static ATTRIBUTE_ALWAYS_INLINE struct partition * |
| 263 | get_part_table(int i) | 263 | get_part_table(int i) |
| 264 | { | 264 | { |
| 265 | return ptes[i].part_table; | 265 | return ptes[i].part_table; |
| @@ -281,7 +281,7 @@ valid_part_table_flag(const char *mbuffer) | |||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | #if ENABLE_FEATURE_FDISK_WRITABLE | 283 | #if ENABLE_FEATURE_FDISK_WRITABLE |
| 284 | extern inline void | 284 | static ATTRIBUTE_ALWAYS_INLINE void |
| 285 | write_part_table_flag(char *b) | 285 | write_part_table_flag(char *b) |
| 286 | { | 286 | { |
| 287 | b[510] = 0x55; | 287 | 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; | |||
| 183 | static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; | 183 | static unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; |
| 184 | static unsigned long req_nr_inodes; | 184 | static unsigned long req_nr_inodes; |
| 185 | 185 | ||
| 186 | extern inline unsigned div_roundup(unsigned size, unsigned n) | 186 | static ATTRIBUTE_ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n) |
| 187 | { | 187 | { |
| 188 | return (size + n-1) / n; | 188 | return (size + n-1) / n; |
| 189 | } | 189 | } |
