#include "unarchive.h"
#ifdef CONFIG_FEATURE_LZMA_FAST
-# define speed_inline ATTRIBUTE_ALWAYS_INLINE
+# define speed_inline ALWAYS_INLINE
#else
# define speed_inline
#endif
}
/* Called once */
-static ATTRIBUTE_ALWAYS_INLINE void rc_free(rc_t * rc)
+static ALWAYS_INLINE void rc_free(rc_t * rc)
{
if (ENABLE_FEATURE_CLEAN_UP)
free(rc);
rc->range <<= 8;
rc->code = (rc->code << 8) | *rc->ptr++;
}
-static ATTRIBUTE_ALWAYS_INLINE void rc_normalize(rc_t * rc)
+static ALWAYS_INLINE void rc_normalize(rc_t * rc)
{
if (rc->range < (1 << RC_TOP_BITS)) {
rc_do_normalize(rc);
rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
return rc->bound;
}
-static ATTRIBUTE_ALWAYS_INLINE int rc_is_bit_0(rc_t * rc, uint16_t * p)
+static ALWAYS_INLINE int rc_is_bit_0(rc_t * rc, uint16_t * p)
{
uint32_t t = rc_is_bit_0_helper(rc, p);
return rc->code < t;
}
/* Called once */
-static ATTRIBUTE_ALWAYS_INLINE int rc_direct_bit(rc_t * rc)
+static ALWAYS_INLINE int rc_direct_bit(rc_t * rc)
{
rc_normalize(rc);
rc->range >>= 1;
return c;
}
-static int ATTRIBUTE_ALWAYS_INLINE isalnum_(int c)
+static int ALWAYS_INLINE isalnum_(int c)
{
return (isalnum(c) || c == '_');
}
#define FLAG_U (1<<12)
#define FLAG_w (1<<13)
+#define g_read_buf bb_common_bufsiz1
+
struct cand {
int x;
int y;
free(_path2);
}
}
-static void fiddle_sum(int *sum, int t)
+static ALWAYS_INLINE int fiddle_sum(int sum, int t)
{
- *sum = (int)(*sum * 127 + t);
+ return sum * 127 + t;
}
/*
* Hash function taken from Robert Sedgewick, Algorithms in C, 3d ed., p 578.
*/
-static int readhash(FILE * f)
+static int readhash(FILE *fp)
{
int i, t, space;
int sum;
sum = 1;
space = 0;
if (!(option_mask32 & (FLAG_b | FLAG_w))) {
- for (i = 0; (t = getc(f)) != '\n'; i++) {
+ for (i = 0; (t = getc(fp)) != '\n'; i++) {
if (t == EOF) {
if (i == 0)
return 0;
break;
}
- fiddle_sum(&sum, t);
+ sum = fiddle_sum(sum, t);
}
} else {
for (i = 0;;) {
- switch (t = getc(f)) {
+ switch (t = getc(fp)) {
case '\t':
case '\r':
case '\v':
i++;
space = 0;
}
- fiddle_sum(&sum, t);
+ sum = fiddle_sum(sum, t);
i++;
continue;
case EOF:
* Check to see if the given files differ.
* Returns 0 if they are the same, 1 if different, and -1 on error.
*/
-static int files_differ(FILE * f1, FILE * f2, int flags)
+static int files_differ(FILE *f1, FILE *f2, int flags)
{
size_t i, j;
return 1;
}
while (1) {
- i = fread(bb_common_bufsiz1, 1, BUFSIZ/2, f1);
- j = fread(bb_common_bufsiz1 + BUFSIZ/2, 1, BUFSIZ/2, f2);
+ i = fread(g_read_buf, 1, COMMON_BUFSIZE/2, f1);
+ j = fread(g_read_buf + COMMON_BUFSIZE/2, 1, COMMON_BUFSIZE/2, f2);
if (i != j)
return 1;
if (i == 0)
return (ferror(f1) || ferror(f2));
- if (memcmp(bb_common_bufsiz1,
- bb_common_bufsiz1 + BUFSIZ/2, i) != 0)
+ if (memcmp(g_read_buf,
+ g_read_buf + COMMON_BUFSIZE/2, i) != 0)
return 1;
}
}
-static void prepare(int i, FILE * fd, off_t filesize)
+static void prepare(int i, FILE *fp /*, off_t filesize*/)
{
struct line *p;
int h;
size_t j, sz;
- rewind(fd);
+ rewind(fp);
- sz = (filesize <= FSIZE_MAX ? filesize : FSIZE_MAX) / 25;
- if (sz < 100)
- sz = 100;
+ /*sz = (filesize <= FSIZE_MAX ? filesize : FSIZE_MAX) / 25;*/
+ /*if (sz < 100)*/
+ sz = 100;
- p = xmalloc((sz + 3) * sizeof(struct line));
+ p = xmalloc((sz + 3) * sizeof(p[0]));
j = 0;
- while ((h = readhash(fd))) {
+ while ((h = readhash(fp))) {
if (j == sz) {
sz = sz * 3 / 2;
- p = xrealloc(p, (sz + 3) * sizeof(struct line));
+ p = xrealloc(p, (sz + 3) * sizeof(p[0]));
}
p[++j].value = h;
}
#if ENABLE_FEATURE_DIFF_BINARY
rewind(f);
- cnt = fread(bb_common_bufsiz1, 1, BUFSIZ, f);
+ cnt = fread(g_read_buf, 1, COMMON_BUFSIZE, f);
for (i = 0; i < cnt; i++) {
- if (!isprint(bb_common_bufsiz1[i])
- && !isspace(bb_common_bufsiz1[i])) {
+ if (!isprint(g_read_buf[i])
+ && !isspace(g_read_buf[i])) {
return 0;
}
}
* 3*(number of k-candidates installed), typically about
* 6n words for files of length n.
*/
-static unsigned diffreg(char * ofile1, char * ofile2, int flags)
+static unsigned diffreg(char *ofile1, char *ofile2, int flags)
{
char *file1 = ofile1;
char *file2 = ofile2;
goto closem;
}
- prepare(0, f1, stb1.st_size);
- prepare(1, f2, stb2.st_size);
+ prepare(0, f1 /*, stb1.st_size*/);
+ prepare(1, f2 /*, stb2.st_size*/);
prune();
sort(sfile[0], slen[0]);
sort(sfile[1], slen[1]);
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])
#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
# 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
#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;
/* (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); } \
/* 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);
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
#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
#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))
#endif
#if UINT_MAX != ULONG_MAX
-static ATTRIBUTE_ALWAYS_INLINE
+static ALWAYS_INLINE
unsigned bb_strtoui(const char *str, char **end, int b)
{
unsigned long v = strtoul(str, end, b);
/**
* Return milliseconds of random delay, up to "secs" seconds.
*/
-static unsigned ATTRIBUTE_ALWAYS_INLINE ms_rdelay(unsigned secs)
+static unsigned ALWAYS_INLINE ms_rdelay(unsigned secs)
{
return lrand48() % (secs * 1000);
}
ptes[i].changed = 0;
}
-static ATTRIBUTE_ALWAYS_INLINE void
+static ALWAYS_INLINE void
set_changed(int i)
{
ptes[i].changed = 1;
}
#endif /* FEATURE_FDISK_WRITABLE */
-static ATTRIBUTE_ALWAYS_INLINE struct partition *
+static ALWAYS_INLINE struct partition *
get_part_table(int i)
{
return ptes[i].part_table;
}
#if ENABLE_FEATURE_FDISK_WRITABLE
-static ATTRIBUTE_ALWAYS_INLINE void
+static ALWAYS_INLINE void
write_part_table_flag(char *b)
{
b[510] = 0x55;
#define MAGIC (Super.s_magic)
/* gcc likes this more (code is smaller) than macro variant */
-static ATTRIBUTE_ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n)
+static ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n)
{
return (size + n-1) / n;
}
#define G (*ptr_to_globals)
-static ATTRIBUTE_ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n)
+static ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n)
{
return (size + n-1) / n;
}