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
This commit is contained in:
Denis Vlasenko
2007-06-12 20:54:54 +00:00
parent fdcbc4e709
commit 3ad5d0cbbe
11 changed files with 69 additions and 67 deletions

View File

@@ -379,9 +379,9 @@ extern char *safe_strncpy(char *dst, const char *src, size_t size);
extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
// gcc-4.1.1 still isn't good enough at optimizing it
// (+200 bytes compared to macro)
//static ATTRIBUTE_ALWAYS_INLINE
//static ALWAYS_INLINE
//int LONE_DASH(const char *s) { return s[0] == '-' && !s[1]; }
//static ATTRIBUTE_ALWAYS_INLINE
//static ALWAYS_INLINE
//int NOT_LONE_DASH(const char *s) { return s[0] != '-' || s[1]; }
#define LONE_DASH(s) ((s)[0] == '-' && !(s)[1])
#define NOT_LONE_DASH(s) ((s)[0] != '-' || (s)[1])
@@ -611,7 +611,7 @@ int write_pidfile(const char *path);
#define remove_pidfile(f) ((void)unlink(f))
#else
/* Why? #defining it to 1 gives "warning: statement with no effect"... */
static ATTRIBUTE_ALWAYS_INLINE int write_pidfile(const char *path) { return 1; }
static ALWAYS_INLINE int write_pidfile(const char *path) { return 1; }
#define remove_pidfile(f) ((void)0)
#endif

View File

@@ -53,14 +53,14 @@
# define ATTRIBUTE_PACKED __attribute__ ((__packed__))
# define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m)))
# if __GNUC_PREREQ (3,0)
# define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) inline
# define ALWAYS_INLINE __attribute__ ((always_inline)) inline
# if !ENABLE_WERROR
# define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
# else
# define ATTRIBUTE_DEPRECATED /* n/a */
# endif
# else
# define ATTRIBUTE_ALWAYS_INLINE inline
# define ALWAYS_INLINE inline
# define ATTRIBUTE_DEPRECATED /* n/a */
# endif
@@ -238,7 +238,7 @@ typedef unsigned smalluint;
#endif
#if defined(__dietlibc__)
static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c)
static ALWAYS_INLINE char* strchrnul(const char *s, char c)
{
while (*s && *s != c) ++s;
return (char*)s;

View File

@@ -33,46 +33,46 @@ DECLARE_STR_CONV(long long, ll, ull)
/* (useful for mapping them to the type of the same width) */
#define DEFINE_EQUIV_STR_CONV(narrow, N, W, UN, UW) \
\
static ATTRIBUTE_ALWAYS_INLINE \
static 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); } \
static ATTRIBUTE_ALWAYS_INLINE \
static 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); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
unsigned narrow xstrto##UN##_sfx(const char *str, int b, const struct suffix_mult *sfx) \
{ return xstrto##UW##_sfx(str, b, sfx); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
unsigned narrow xstrto##UN(const char *str, int b) \
{ return xstrto##UW(str, b); } \
static ATTRIBUTE_ALWAYS_INLINE \
static 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); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
unsigned narrow xato##UN##_range(const char *str, unsigned narrow l, unsigned narrow u) \
{ return xato##UW##_range(str, l, u); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
unsigned narrow xato##UN##_sfx(const char *str, const struct suffix_mult *sfx) \
{ return xato##UW##_sfx(str, sfx); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
unsigned narrow xato##UN(const char *str) \
{ return xato##UW(str); } \
static ATTRIBUTE_ALWAYS_INLINE \
static 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); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
narrow xstrto##N##_range(const char *str, int b, narrow l, narrow u) \
{ return xstrto##W##_range(str, b, l, u); } \
static ATTRIBUTE_ALWAYS_INLINE \
static 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); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
narrow xato##N##_range(const char *str, narrow l, narrow u) \
{ return xato##W##_range(str, l, u); } \
static ATTRIBUTE_ALWAYS_INLINE \
static ALWAYS_INLINE \
narrow xato##N##_sfx(const char *str, const struct suffix_mult *sfx) \
{ return xato##W##_sfx(str, sfx); } \
static ATTRIBUTE_ALWAYS_INLINE \
static 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);
static ATTRIBUTE_ALWAYS_INLINE uint32_t xatou32(const char *numstr)
static ALWAYS_INLINE uint32_t xatou32(const char *numstr)
{
if (UINT_MAX == 0xffffffff)
return xatou(numstr);
@@ -111,10 +111,10 @@ 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
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
unsigned long bb_strtoul(const char *arg, char **endp, int base)
{ return bb_strtoull(arg, endp, base); }
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
long bb_strtol(const char *arg, char **endp, int base)
{ return bb_strtoll(arg, endp, base); }
#else
@@ -123,17 +123,17 @@ long bb_strtol(const char *arg, char **endp, int base);
#endif
#if UINT_MAX == ULLONG_MAX
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
unsigned bb_strtou(const char *arg, char **endp, int base)
{ return bb_strtoull(arg, endp, base); }
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
int bb_strtoi(const char *arg, char **endp, int base)
{ return bb_strtoll(arg, endp, base); }
#elif UINT_MAX == ULONG_MAX
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
unsigned bb_strtou(const char *arg, char **endp, int base)
{ return bb_strtoul(arg, endp, base); }
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
int bb_strtoi(const char *arg, char **endp, int base)
{ return bb_strtol(arg, endp, base); }
#else
@@ -142,7 +142,7 @@ int bb_strtoi(const char *arg, char **endp, int base);
#endif
int BUG_bb_strtou32_unimplemented(void);
static ATTRIBUTE_ALWAYS_INLINE
static ALWAYS_INLINE
uint32_t bb_strtou32(const char *arg, char **endp, int base)
{
if (sizeof(uint32_t) == sizeof(unsigned))