diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-12 20:54:54 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-12 20:54:54 +0000 |
| commit | 3ad5d0cbbe3c6debc8d3431fadf973eff04b27bf (patch) | |
| tree | ea3c3db1efdd618bf819f97d73f93f276f309137 /include | |
| parent | fdcbc4e7095c225a8586dcb96a7a99c2d1007aeb (diff) | |
| download | busybox-w32-3ad5d0cbbe3c6debc8d3431fadf973eff04b27bf.tar.gz busybox-w32-3ad5d0cbbe3c6debc8d3431fadf973eff04b27bf.tar.bz2 busybox-w32-3ad5d0cbbe3c6debc8d3431fadf973eff04b27bf.zip | |
diff: shrink code (-85 bytes):
function old new delta
fiddle_sum 8 - -8
diffreg 2717 2690 -27
prepare 334 284 -50
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-85) Total: -85 bytes
s/ATTRIBUTE_ALWAYS_INLINE/ALWAYS_INLINE/g
Diffstat (limited to 'include')
| -rw-r--r-- | include/libbb.h | 6 | ||||
| -rw-r--r-- | include/platform.h | 6 | ||||
| -rw-r--r-- | include/xatonum.h | 44 |
3 files changed, 28 insertions, 28 deletions
diff --git a/include/libbb.h b/include/libbb.h index d42ce5f39..c4743cf0f 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -379,9 +379,9 @@ extern char *safe_strncpy(char *dst, const char *src, size_t size); | |||
| 379 | extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); | 379 | extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
| 380 | // gcc-4.1.1 still isn't good enough at optimizing it | 380 | // gcc-4.1.1 still isn't good enough at optimizing it |
| 381 | // (+200 bytes compared to macro) | 381 | // (+200 bytes compared to macro) |
| 382 | //static ATTRIBUTE_ALWAYS_INLINE | 382 | //static ALWAYS_INLINE |
| 383 | //int LONE_DASH(const char *s) { return s[0] == '-' && !s[1]; } | 383 | //int LONE_DASH(const char *s) { return s[0] == '-' && !s[1]; } |
| 384 | //static ATTRIBUTE_ALWAYS_INLINE | 384 | //static ALWAYS_INLINE |
| 385 | //int NOT_LONE_DASH(const char *s) { return s[0] != '-' || s[1]; } | 385 | //int NOT_LONE_DASH(const char *s) { return s[0] != '-' || s[1]; } |
| 386 | #define LONE_DASH(s) ((s)[0] == '-' && !(s)[1]) | 386 | #define LONE_DASH(s) ((s)[0] == '-' && !(s)[1]) |
| 387 | #define NOT_LONE_DASH(s) ((s)[0] != '-' || (s)[1]) | 387 | #define NOT_LONE_DASH(s) ((s)[0] != '-' || (s)[1]) |
| @@ -611,7 +611,7 @@ int write_pidfile(const char *path); | |||
| 611 | #define remove_pidfile(f) ((void)unlink(f)) | 611 | #define remove_pidfile(f) ((void)unlink(f)) |
| 612 | #else | 612 | #else |
| 613 | /* Why? #defining it to 1 gives "warning: statement with no effect"... */ | 613 | /* Why? #defining it to 1 gives "warning: statement with no effect"... */ |
| 614 | static ATTRIBUTE_ALWAYS_INLINE int write_pidfile(const char *path) { return 1; } | 614 | static ALWAYS_INLINE int write_pidfile(const char *path) { return 1; } |
| 615 | #define remove_pidfile(f) ((void)0) | 615 | #define remove_pidfile(f) ((void)0) |
| 616 | #endif | 616 | #endif |
| 617 | 617 | ||
diff --git a/include/platform.h b/include/platform.h index c2013b39d..9c93efb53 100644 --- a/include/platform.h +++ b/include/platform.h | |||
| @@ -53,14 +53,14 @@ | |||
| 53 | # define ATTRIBUTE_PACKED __attribute__ ((__packed__)) | 53 | # define ATTRIBUTE_PACKED __attribute__ ((__packed__)) |
| 54 | # define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) | 54 | # define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m))) |
| 55 | # if __GNUC_PREREQ (3,0) | 55 | # if __GNUC_PREREQ (3,0) |
| 56 | # define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) inline | 56 | # define ALWAYS_INLINE __attribute__ ((always_inline)) inline |
| 57 | # if !ENABLE_WERROR | 57 | # if !ENABLE_WERROR |
| 58 | # define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) | 58 | # define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) |
| 59 | # else | 59 | # else |
| 60 | # define ATTRIBUTE_DEPRECATED /* n/a */ | 60 | # define ATTRIBUTE_DEPRECATED /* n/a */ |
| 61 | # endif | 61 | # endif |
| 62 | # else | 62 | # else |
| 63 | # define ATTRIBUTE_ALWAYS_INLINE inline | 63 | # define ALWAYS_INLINE inline |
| 64 | # define ATTRIBUTE_DEPRECATED /* n/a */ | 64 | # define ATTRIBUTE_DEPRECATED /* n/a */ |
| 65 | # endif | 65 | # endif |
| 66 | 66 | ||
| @@ -238,7 +238,7 @@ typedef unsigned smalluint; | |||
| 238 | #endif | 238 | #endif |
| 239 | 239 | ||
| 240 | #if defined(__dietlibc__) | 240 | #if defined(__dietlibc__) |
| 241 | static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) | 241 | static ALWAYS_INLINE char* strchrnul(const char *s, char c) |
| 242 | { | 242 | { |
| 243 | while (*s && *s != c) ++s; | 243 | while (*s && *s != c) ++s; |
| 244 | return (char*)s; | 244 | return (char*)s; |
diff --git a/include/xatonum.h b/include/xatonum.h index cf088a49e..e613fce6b 100644 --- a/include/xatonum.h +++ b/include/xatonum.h | |||
| @@ -33,46 +33,46 @@ DECLARE_STR_CONV(long long, ll, ull) | |||
| 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 36 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 39 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 42 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 45 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 48 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 51 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 54 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 57 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 60 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 63 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 66 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 69 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 72 | static 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 | static ATTRIBUTE_ALWAYS_INLINE \ | 75 | static 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 | static ATTRIBUTE_ALWAYS_INLINE uint32_t xatou32(const char *numstr) | 99 | static 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,10 +111,10 @@ 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 | static ATTRIBUTE_ALWAYS_INLINE | 114 | static 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 | static ATTRIBUTE_ALWAYS_INLINE | 117 | static ALWAYS_INLINE |
| 118 | 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 |
| @@ -123,17 +123,17 @@ 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 | static ATTRIBUTE_ALWAYS_INLINE | 126 | static ALWAYS_INLINE |
| 127 | unsigned 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 | static ATTRIBUTE_ALWAYS_INLINE | 129 | static ALWAYS_INLINE |
| 130 | int 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 | static ATTRIBUTE_ALWAYS_INLINE | 133 | static ALWAYS_INLINE |
| 134 | unsigned 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 | static ATTRIBUTE_ALWAYS_INLINE | 136 | static ALWAYS_INLINE |
| 137 | int 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 |
| @@ -142,7 +142,7 @@ 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 | static ATTRIBUTE_ALWAYS_INLINE | 145 | static 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)) |
