summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko2007-08-12 20:58:27 +0000
committerDenis Vlasenko2007-08-12 20:58:27 +0000
commit6ca409e0e4c198fe3081346eebbae3f068fe605a (patch)
tree060cb05d99220a1eda399194d1209c269f0e8cd8 /archival
parent4185548984357df91311f30c8e43d95f33922576 (diff)
downloadbusybox-6ca409e0e4c198fe3081346eebbae3f068fe605a.zip
busybox-6ca409e0e4c198fe3081346eebbae3f068fe605a.tar.gz
trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount of padding (unfortunately, needs hand editing ATM). *: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts size saving: 0.5k
Diffstat (limited to 'archival')
-rw-r--r--archival/ar.c8
-rw-r--r--archival/dpkg.c5
-rw-r--r--archival/gzip.c14
-rw-r--r--archival/libunarchive/decompress_unzip.c12
-rw-r--r--archival/tar.c2
5 files changed, 21 insertions, 20 deletions
diff --git a/archival/ar.c b/archival/ar.c
index e85ca5c..7b16c2b 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -41,10 +41,11 @@ static void header_verbose_list_ar(const file_header_t *file_header)
int ar_main(int argc, char **argv);
int ar_main(int argc, char **argv)
{
+ static const char msg_unsupported_err[] ALIGN1 =
+ "archive %s is not supported";
+
archive_handle_t *archive_handle;
unsigned opt;
- static const char msg_unsupported_err[] =
- "Archive %s not supported. Install binutils 'ar'.";
char magic[8];
archive_handle = init_handle();
@@ -88,7 +89,8 @@ int ar_main(int argc, char **argv)
}
archive_handle->offset += 7;
- while (get_header_ar(archive_handle) == EXIT_SUCCESS) /* repeat */;
+ while (get_header_ar(archive_handle) == EXIT_SUCCESS)
+ continue;
return EXIT_SUCCESS;
}
diff --git a/archival/dpkg.c b/archival/dpkg.c
index bd729a2..0c1f96f 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -582,7 +582,8 @@ static int read_package_field(const char *package_buffer, char **field_name, cha
static unsigned fill_package_struct(char *control_buffer)
{
- static const char field_names[] = "Package\0""Version\0"
+ static const char field_names[] ALIGN1 =
+ "Package\0""Version\0"
"Pre-Depends\0""Depends\0""Replaces\0""Provides\0"
"Conflicts\0""Suggests\0""Recommends\0""Enhances\0";
@@ -1226,7 +1227,7 @@ static int run_package_script(const char *package_name, const char *script_type)
return result;
}
-static const char *all_control_files[] = {
+static const char *const all_control_files[] = {
"preinst", "postinst", "prerm", "postrm",
"list", "md5sums", "shlibs", "conffiles",
"config", "templates", NULL
diff --git a/archival/gzip.c b/archival/gzip.c
index 08c660e..83d78e4 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -768,26 +768,24 @@ static void check_match(IPos start, IPos match, int length)
#define BL_CODES 19
/* number of codes used to transfer the bit lengths */
-typedef uch extra_bits_t;
-
/* extra bits for each length code */
-static const extra_bits_t extra_lbits[LENGTH_CODES]= {
+static const uint8_t extra_lbits[LENGTH_CODES] ALIGN1 = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
4, 4, 5, 5, 5, 5, 0
};
/* extra bits for each distance code */
-static const extra_bits_t extra_dbits[D_CODES] = {
+static const uint8_t extra_dbits[D_CODES] ALIGN1 = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 13, 13
};
/* extra bits for each bit length code */
-static const extra_bits_t extra_blbits[BL_CODES] = {
+static const uint8_t extra_blbits[BL_CODES] ALIGN1 = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 };
/* number of codes at each bit length for an optimal tree */
-static const uch bl_order[BL_CODES] = {
+static const uint8_t bl_order[BL_CODES] ALIGN1 = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
#define STORED_BLOCK 0
@@ -861,7 +859,7 @@ typedef struct ct_data {
typedef struct tree_desc {
ct_data *dyn_tree; /* the dynamic tree */
ct_data *static_tree; /* corresponding static tree or NULL */
- const extra_bits_t *extra_bits; /* extra bits for each code or NULL */
+ const uint8_t *extra_bits; /* extra bits for each code or NULL */
int extra_base; /* base index for extra_bits */
int elems; /* max number of elements in the tree */
int max_length; /* max bit length for the codes */
@@ -1064,7 +1062,7 @@ static void pqdownheap(ct_data * tree, int k)
static void gen_bitlen(tree_desc * desc)
{
ct_data *tree = desc->dyn_tree;
- const extra_bits_t *extra = desc->extra_bits;
+ const uint8_t *extra = desc->extra_bits;
int base = desc->extra_base;
int max_code = desc->max_code;
int max_length = desc->max_length;
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index c698763..ead628e 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -182,39 +182,39 @@ static state_t* alloc_state(void)
#endif
-static const unsigned short mask_bits[] = {
+static const unsigned short mask_bits[] ALIGN2 = {
0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
};
/* Copy lengths for literal codes 257..285 */
-static const unsigned short cplens[] = {
+static const unsigned short cplens[] ALIGN2 = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
};
/* note: see note #13 above about the 258 in this list. */
/* Extra bits for literal codes 257..285 */
-static const unsigned char cplext[] = {
+static const unsigned char cplext[] ALIGN1 = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5,
5, 5, 5, 0, 99, 99
}; /* 99 == invalid */
/* Copy offsets for distance codes 0..29 */
-static const unsigned short cpdist[] = {
+static const unsigned short cpdist[] ALIGN2 = {
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513,
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
};
/* Extra bits for distance codes */
-static const unsigned char cpdext[] = {
+static const unsigned char cpdext[] ALIGN1 = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
11, 11, 12, 12, 13, 13
};
/* Tables for deflate from PKZIP's appnote.txt. */
/* Order of the bit length code lengths */
-static const unsigned char border[] = {
+static const unsigned char border[] ALIGN1 = {
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
diff --git a/archival/tar.c b/archival/tar.c
index 7d7bf79..bed8cf2 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -715,7 +715,7 @@ enum {
OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions
};
#if ENABLE_FEATURE_TAR_LONG_OPTIONS
-static const char tar_longopts[] =
+static const char tar_longopts[] ALIGN1 =
"list\0" No_argument "t"
"extract\0" No_argument "x"
"directory\0" Required_argument "C"