diff options
author | Denis Vlasenko | 2007-08-12 20:58:27 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-08-12 20:58:27 +0000 |
commit | 6ca409e0e4c198fe3081346eebbae3f068fe605a (patch) | |
tree | 060cb05d99220a1eda399194d1209c269f0e8cd8 | |
parent | 4185548984357df91311f30c8e43d95f33922576 (diff) | |
download | busybox-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
119 files changed, 494 insertions, 447 deletions
@@ -569,7 +569,7 @@ busybox-all := $(core-y) $(libs-y) # May be overridden by arch/$(ARCH)/Makefile quiet_cmd_busybox__ ?= LINK $@ cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) $(LDFLAGS) \ - -o $@ -Wl,-M \ + -o $@ -Wl,-Map -Wl,$@.map \ -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ -Wl,--start-group $(busybox-all) -Wl,--end-group \ $(LDLIBS) diff --git a/applets/Kbuild b/applets/Kbuild index e6c5bd5..cf7d297 100644 --- a/applets/Kbuild +++ b/applets/Kbuild @@ -20,6 +20,6 @@ quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h HOSTCFLAGS_usage.o = -I$(srctree)/include applets/applets.o: include/usage_compressed.h -applets/usage: .config -include/usage_compressed.h: applets/usage +applets/usage: .config $(srctree)/applets/usage_compressed +include/usage_compressed.h: applets/usage $(srctree)/applets/usage_compressed $(call cmd,gen_usage_compressed) diff --git a/applets/applets.c b/applets/applets.c index 89dea3e..6ff4301 100644 --- a/applets/applets.c +++ b/applets/applets.c @@ -34,7 +34,7 @@ #if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE /* Define usage_messages[] */ -static const char usage_messages[] = "" +static const char usage_messages[] ALIGN1 = "" #define MAKE_USAGE #include "usage.h" #include "applets.h" @@ -108,12 +108,12 @@ static char *get_trimmed_slice(char *s, char *e) } /* Don't depend on the tools to combine strings. */ -static const char config_file[] = "/etc/busybox.conf"; +static const char config_file[] ALIGN1 = "/etc/busybox.conf"; /* We don't supply a value for the nul, so an index adjustment is * necessary below. Also, we use unsigned short here to save some * space even though these are really mode_t values. */ -static const unsigned short mode_mask[] = { +static const unsigned short mode_mask[] ALIGN2 = { /* SST sst xxx --- */ S_ISUID, S_ISUID|S_IXUSR, S_IXUSR, 0, /* user */ S_ISGID, S_ISGID|S_IXGRP, S_IXGRP, 0, /* group */ @@ -255,7 +255,7 @@ static void parse_config_file(void) for (i = 0; i < 3; i++) { /* There are 4 chars + 1 nul for each of user/group/other. */ - static const char mode_chars[] = "Ssx-\0" "Ssx-\0" "Ttx-"; + static const char mode_chars[] ALIGN1 = "Ssx-\0" "Ssx-\0" "Ttx-"; const char *q; q = strchrnul(mode_chars + 5*i, *e++); @@ -499,8 +499,8 @@ static void install_links(const char *busybox, int use_symbolic_links) /* directory table * this should be consistent w/ the enum, * busybox.h::bb_install_loc_t, or else... */ - static const char usr_bin [] = "/usr/bin"; - static const char usr_sbin[] = "/usr/sbin"; + static const char usr_bin [] ALIGN1 = "/usr/bin"; + static const char usr_sbin[] ALIGN1 = "/usr/sbin"; static const char *const install_dir[] = { &usr_bin [8], /* "", equivalent to "/" for concat_path_file() */ &usr_bin [4], /* "/bin" */ diff --git a/applets/usage_compressed b/applets/usage_compressed index fd581cc..9da6830 100755 --- a/applets/usage_compressed +++ b/applets/usage_compressed @@ -12,7 +12,7 @@ sz=`"$loc/usage" | wc -c` || exit 1 exec >"$target" -echo 'static const char packed_usage[] = ' +echo 'static const char packed_usage[] ALIGN1 = ' "$loc/usage" | bzip2 -1 | od -v -t x1 \ | $SED -e 's/^[^ ]*//' -e 's/ *\(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/' echo ';' 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" diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c index 5908dad..a9bbc78 100644 --- a/console-tools/setconsole.c +++ b/console-tools/setconsole.c @@ -11,7 +11,7 @@ #include "libbb.h" #if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS -static const char setconsole_longopts[] = +static const char setconsole_longopts[] ALIGN1 = "reset\0" No_argument "r" ; #endif diff --git a/coreutils/cal.c b/coreutils/cal.c index f8fc0b0..37aca00 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c @@ -30,11 +30,11 @@ #define MAXDAYS 42 /* max slots in a month array */ #define SPACE -1 /* used in day array */ -static const unsigned char days_in_month[] = { +static const unsigned char days_in_month[] ALIGN1 = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -static const unsigned char sep1752[] = { +static const unsigned char sep1752[] ALIGN1 = { 1, 2, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 diff --git a/coreutils/cut.c b/coreutils/cut.c index 435b210..2598a9a 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -15,7 +15,7 @@ /* option vars */ -static const char optstring[] = "b:c:f:d:sn"; +static const char optstring[] ALIGN1 = "b:c:f:d:sn"; #define CUT_OPT_BYTE_FLGS (1<<0) #define CUT_OPT_CHAR_FLGS (1<<1) #define CUT_OPT_FIELDS_FLGS (1<<2) @@ -163,7 +163,7 @@ static void cut_file(FILE * file) } } -static const char _op_on_field[] = " only when operating on fields"; +static const char _op_on_field[] ALIGN1 = " only when operating on fields"; int cut_main(int argc, char **argv); int cut_main(int argc, char **argv) diff --git a/coreutils/date.c b/coreutils/date.c index 5e2bcee..5ee70f7 100644 --- a/coreutils/date.c +++ b/coreutils/date.c @@ -63,8 +63,9 @@ int date_main(int argc, char **argv) if (!isofmt_arg) { ifmt = 0; /* default is date */ } else { - static const char * const isoformats[] = - { "date", "hours", "minutes", "seconds" }; + static const char *const isoformats[] = { + "date", "hours", "minutes", "seconds" + }; for (ifmt = 0; ifmt < 4; ifmt++) if (!strcmp(isofmt_arg, isoformats[ifmt])) diff --git a/coreutils/dd.c b/coreutils/dd.c index 3b4b1d7..b17bb59 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -46,7 +46,7 @@ static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal) } static ssize_t full_write_or_warn(int fd, const void *buf, size_t len, - const char * const filename) + const char *const filename) { ssize_t n = full_write(fd, buf, len); if (n < 0) @@ -83,7 +83,7 @@ int dd_main(int argc, char **argv) FLAG_TWOBUFS = 1 << 3, FLAG_COUNT = 1 << 4, }; - static const char keywords[] = + static const char keywords[] ALIGN1 = "bs=\0""count=\0""seek=\0""skip=\0""if=\0""of=\0" #if ENABLE_FEATURE_DD_IBS_OBS "ibs=\0""obs=\0""conv=\0""notrunc\0""sync\0""noerror\0" diff --git a/coreutils/df.c b/coreutils/df.c index 8273080..5154eeb 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -42,7 +42,8 @@ int df_main(int argc, char **argv) FILE *mount_table; struct mntent *mount_entry; struct statfs s; - static const char hdr_1k[] = "1k-blocks"; /* default display is kilobytes */ + /* default display is kilobytes */ + static const char hdr_1k[] ALIGN1 = "1k-blocks"; const char *disp_units_hdr = hdr_1k; #ifdef CONFIG_FEATURE_HUMAN_READABLE diff --git a/coreutils/du.c b/coreutils/du.c index cb3e715..1974871 100644 --- a/coreutils/du.c +++ b/coreutils/du.c @@ -48,7 +48,7 @@ static int one_file_system; static dev_t dir_dev; -static void print(long size, const char * const filename) +static void print(long size, const char *const filename) { /* TODO - May not want to defer error checking here. */ #if ENABLE_FEATURE_HUMAN_READABLE @@ -64,7 +64,7 @@ static void print(long size, const char * const filename) } /* tiny recursive du */ -static long du(const char * const filename) +static long du(const char *const filename) { struct stat statbuf; long sum; diff --git a/coreutils/env.c b/coreutils/env.c index 3008358..dc86671 100644 --- a/coreutils/env.c +++ b/coreutils/env.c @@ -35,7 +35,7 @@ extern char **environ; #include "libbb.h" #if ENABLE_FEATURE_ENV_LONG_OPTIONS -static const char env_longopts[] = +static const char env_longopts[] ALIGN1 = "ignore-environment\0" No_argument "i" "unset\0" Required_argument "u" ; diff --git a/coreutils/expr.c b/coreutils/expr.c index 6a4683d..318fee7 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c @@ -277,7 +277,7 @@ static VALUE *eval7(void) static VALUE *eval6(void) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "quote\0""length\0""match\0""index\0""substr\0"; VALUE *r, *i1, *i2; diff --git a/coreutils/head.c b/coreutils/head.c index bffba40..a48f147 100644 --- a/coreutils/head.c +++ b/coreutils/head.c @@ -13,7 +13,7 @@ #include "libbb.h" -static const char head_opts[] = +static const char head_opts[] ALIGN1 = "n:" #if ENABLE_FEATURE_FANCY_HEAD "c:qv" @@ -29,7 +29,7 @@ static const struct suffix_mult head_suffixes[] = { }; #endif -static const char header_fmt_str[] = "\n==> %s <==\n"; +static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n"; int head_main(int argc, char **argv); int head_main(int argc, char **argv) diff --git a/coreutils/install.c b/coreutils/install.c index c2638f4..79cd020 100644 --- a/coreutils/install.c +++ b/coreutils/install.c @@ -16,7 +16,7 @@ #include "libcoreutils/coreutils.h" #if ENABLE_FEATURE_INSTALL_LONG_OPTIONS -static const char install_longopts[] = +static const char install_longopts[] ALIGN1 = "directory\0" No_argument "d" "preserve-timestamps\0" No_argument "p" "strip\0" No_argument "s" diff --git a/coreutils/ls.c b/coreutils/ls.c index 920fad8..2b29255 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -120,7 +120,7 @@ SPLIT_SUBDIR = 2, static smallint show_color; /* long option entry used only for --color, which has no short option * equivalent */ -static const char ls_color_opt[] = +static const char ls_color_opt[] ALIGN1 = "color\0" Optional_argument "\xff" /* no short equivalent */ ; #else @@ -710,7 +710,8 @@ static int list_single(struct dnode *dn) /* "[-]SXvThw", GNU options, busybox optionally supports */ /* "[-]K", SELinux mandated options, busybox optionally supports */ /* "[-]e", I think we made this one up */ -static const char ls_options[] = "Cadil1gnsxAk" +static const char ls_options[] ALIGN1 = + "Cadil1gnsxAk" USE_FEATURE_LS_TIMESTAMPS("cetu") USE_FEATURE_LS_SORTFILES("SXrv") USE_FEATURE_LS_FILETYPES("Fp") diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index a6eaa96..22a070c 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -25,7 +25,7 @@ /* This is a NOFORK applet. Be very careful! */ #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS -static const char mkdir_longopts[] = +static const char mkdir_longopts[] ALIGN1 = "mode\0" Required_argument "m" "parents\0" No_argument "p" #if ENABLE_SELINUX diff --git a/coreutils/mknod.c b/coreutils/mknod.c index 415ef55..ea6f24a 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c @@ -14,7 +14,7 @@ #include "libbb.h" #include "libcoreutils/coreutils.h" -static const char modes_chars[] = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 }; +static const char modes_chars[] ALIGN1 = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 }; static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK }; int mknod_main(int argc, char **argv); diff --git a/coreutils/mv.c b/coreutils/mv.c index 0644078..4cd0fcf 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c @@ -21,7 +21,7 @@ #include "libcoreutils/coreutils.h" #if ENABLE_FEATURE_MV_LONG_OPTIONS -static const char mv_longopts[] = +static const char mv_longopts[] ALIGN1 = "interactive\0" No_argument "i" "force\0" No_argument "f" ; @@ -30,7 +30,8 @@ static const char mv_longopts[] = #define OPT_FILEUTILS_FORCE 1 #define OPT_FILEUTILS_INTERACTIVE 2 -static const char fmt[] = "cannot overwrite %sdirectory with %sdirectory"; +static const char fmt[] ALIGN1 = + "cannot overwrite %sdirectory with %sdirectory"; int mv_main(int argc, char **argv); int mv_main(int argc, char **argv) diff --git a/coreutils/od.c b/coreutils/od.c index 00de080..114a746 100644 --- a/coreutils/od.c +++ b/coreutils/od.c @@ -131,7 +131,7 @@ odoffset(int argc, char ***argvp) } } -static const char * const add_strings[] = { +static const char *const add_strings[] = { "16/1 \"%3_u \" \"\\n\"", /* a */ "8/2 \" %06o \" \"\\n\"", /* B, o */ "16/1 \"%03o \" \"\\n\"", /* b */ @@ -147,9 +147,9 @@ static const char * const add_strings[] = { "4/4 \" %011o \" \"\\n\"", /* O */ }; -static const char od_opts[] = "aBbcDdeFfHhIiLlOoXxv"; +static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxv"; -static const char od_o2si[] = { +static const char od_o2si[] ALIGN1 = { 0, 1, 2, 3, 5, 4, 6, 6, 7, 8, 9, 0xa, 0xb, 0xa, 0xa, diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index e308605..d3c9f9a 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c @@ -129,20 +129,20 @@ struct tspec { 10 unsigned decimal 8 unsigned hexadecimal */ -static const uint8_t bytes_to_oct_digits[] = +static const uint8_t bytes_to_oct_digits[] ALIGN1 = {0, 3, 6, 8, 11, 14, 16, 19, 22, 25, 27, 30, 32, 35, 38, 41, 43}; -static const uint8_t bytes_to_signed_dec_digits[] = +static const uint8_t bytes_to_signed_dec_digits[] ALIGN1 = {1, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 28, 30, 33, 35, 37, 40}; -static const uint8_t bytes_to_unsigned_dec_digits[] = +static const uint8_t bytes_to_unsigned_dec_digits[] ALIGN1 = {0, 3, 5, 8, 10, 13, 15, 17, 20, 22, 25, 27, 29, 32, 34, 37, 39}; -static const uint8_t bytes_to_hex_digits[] = +static const uint8_t bytes_to_hex_digits[] ALIGN1 = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32}; /* Convert enum size_spec to the size of the named type. */ -static const signed char width_bytes[] = { +static const signed char width_bytes[] ALIGN1 = { -1, sizeof(char), sizeof(short), @@ -212,7 +212,7 @@ static char const *const default_file_list[] = { "-", NULL }; static FILE *in_stream; #define MAX_INTEGRAL_TYPE_SIZE sizeof(ulonglong_t) -static unsigned char integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1] = { +static unsigned char integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1] ALIGN1 = { [sizeof(char)] = CHAR, #if USHRT_MAX != UCHAR_MAX [sizeof(short)] = SHORT, @@ -229,11 +229,11 @@ static unsigned char integral_type_size[MAX_INTEGRAL_TYPE_SIZE + 1] = { }; #define MAX_FP_TYPE_SIZE sizeof(longdouble_t) -static unsigned char fp_type_size[MAX_FP_TYPE_SIZE + 1] = { +static unsigned char fp_type_size[MAX_FP_TYPE_SIZE + 1] ALIGN1 = { /* gcc seems to allow repeated indexes. Last one stays */ [sizeof(longdouble_t)] = FLOAT_LONG_DOUBLE, [sizeof(double)] = FLOAT_DOUBLE, - [sizeof(float)] = FLOAT_SINGLE, + [sizeof(float)] = FLOAT_SINGLE }; @@ -383,7 +383,7 @@ print_named_ascii(size_t n_bytes, const char *block, const char *unused_fmt_string ATTRIBUTE_UNUSED) { /* Names for some non-printing characters. */ - static const char charname[33][3] = { + static const char charname[33][3] ALIGN1 = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", " bs", " ht", " nl", " vt", " ff", " cr", " so", " si", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", @@ -560,7 +560,7 @@ decode_one_format(const char *s_orig, const char *s, const char **next, case 'o': case 'u': case 'x': { - static const char CSIL[] = "CSIL"; + static const char CSIL[] ALIGN1 = "CSIL"; c = *s++; p = strchr(CSIL, *s); @@ -596,7 +596,7 @@ decode_one_format(const char *s_orig, const char *s, const char **next, size_spec = integral_type_size[size]; { - static const char doux[] = "doux"; + static const char doux[] ALIGN1 = "doux"; static const char doux_fmt_letter[][4] = { "lld", "llo", "llu", "llx" }; @@ -653,7 +653,7 @@ decode_one_format(const char *s_orig, const char *s, const char **next, } case 'f': { - static const char FDL[] = "FDL"; + static const char FDL[] ALIGN1 = "FDL"; fmt = FLOATING_POINT; ++s; @@ -836,7 +836,7 @@ format_address_none(off_t address ATTRIBUTE_UNUSED, char c ATTRIBUTE_UNUSED) { } -static char address_fmt[] = "%0n"OFF_FMT"xc"; +static char address_fmt[] ALIGN1 = "%0n"OFF_FMT"xc"; /* Corresponds to 'x' above */ #define address_base_char address_fmt[sizeof(address_fmt)-3] /* Corresponds to 'n' above */ @@ -1233,7 +1233,7 @@ int od_main(int argc, char **argv) OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG, }; #if ENABLE_GETOPT_LONG - static const char od_longopts[] = + static const char od_longopts[] ALIGN1 = "skip-bytes\0" Required_argument "j" "address-radix\0" Required_argument "A" "read-bytes\0" Required_argument "N" @@ -1268,11 +1268,11 @@ int od_main(int argc, char **argv) argc -= optind; argv += optind; if (opt & OPT_A) { - static const char doxn[] = "doxn"; - static const char doxn_address_base_char[] = { + static const char doxn[] ALIGN1 = "doxn"; + static const char doxn_address_base_char[] ALIGN1 = { 'u', 'o', 'x', /* '?' fourth one is not important */ }; - static const uint8_t doxn_address_pad_len_char[] = { + static const uint8_t doxn_address_pad_len_char[] ALIGN1 = { '7', '7', '6', /* '?' */ }; char *p; diff --git a/coreutils/sort.c b/coreutils/sort.c index 6371139..98c1bc3 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -23,7 +23,7 @@ */ /* These are sort types */ -static const char OPT_STR[] = "ngMucszbrdfimS:T:o:k:t:"; +static const char OPT_STR[] ALIGN1 = "ngMucszbrdfimS:T:o:k:t:"; enum { FLAG_n = 1, /* Numeric sort */ FLAG_g = 2, /* Sort using strtod() */ diff --git a/coreutils/stat.c b/coreutils/stat.c index 7c72127..0fddea2 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c @@ -21,7 +21,7 @@ #define OPT_DEREFERENCE (1<<2) #define OPT_SELINUX (1<<3) -static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")]; +static char buf[sizeof("YYYY-MM-DD HH:MM:SS.000000000")] ALIGN1; static char const * file_type(struct stat const *st) { @@ -70,7 +70,7 @@ static char const *human_fstype(long f_type) int i; static const struct types { long type; - const char * const fs; + const char *const fs; } humantypes[] = { { 0xADFF, "affs" }, { 0x1Cd1, "devpts" }, @@ -118,7 +118,7 @@ static char const *human_fstype(long f_type) #if ENABLE_FEATURE_STAT_FORMAT /* print statfs info */ static void print_statfs(char *pformat, const size_t buf_len, const char m, - const char * const filename, void const *data + const char *const filename, void const *data USE_SELINUX(, security_context_t scontext)) { struct statfs const *statfsbuf = data; @@ -168,7 +168,7 @@ static void print_statfs(char *pformat, const size_t buf_len, const char m, /* print stat info */ static void print_stat(char *pformat, const size_t buf_len, const char m, - const char * const filename, void const *data + const char *const filename, void const *data USE_SELINUX(, security_context_t scontext)) { #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) diff --git a/coreutils/stty.c b/coreutils/stty.c index fbb72ba..863f28d 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -127,28 +127,28 @@ enum { control, input, output, local, combination }; -static const char evenp [] = "evenp"; -static const char raw [] = "raw"; -static const char stty_min [] = "min"; -static const char stty_time [] = "time"; -static const char stty_swtch[] = "swtch"; -static const char stty_eol [] = "eol"; -static const char stty_eof [] = "eof"; -static const char parity [] = "parity"; -static const char stty_oddp [] = "oddp"; -static const char stty_nl [] = "nl"; -static const char stty_ek [] = "ek"; -static const char stty_sane [] = "sane"; -static const char cbreak [] = "cbreak"; -static const char stty_pass8[] = "pass8"; -static const char litout [] = "litout"; -static const char cooked [] = "cooked"; -static const char decctlq [] = "decctlq"; -static const char stty_tabs [] = "tabs"; -static const char stty_lcase[] = "lcase"; -static const char stty_LCASE[] = "LCASE"; -static const char stty_crt [] = "crt"; -static const char stty_dec [] = "dec"; +static const char evenp [] ALIGN1 = "evenp"; +static const char raw [] ALIGN1 = "raw"; +static const char stty_min [] ALIGN1 = "min"; +static const char stty_time [] ALIGN1 = "time"; +static const char stty_swtch[] ALIGN1 = "swtch"; +static const char stty_eol [] ALIGN1 = "eol"; +static const char stty_eof [] ALIGN1 = "eof"; +static const char parity [] ALIGN1 = "parity"; +static const char stty_oddp [] ALIGN1 = "oddp"; +static const char stty_nl [] ALIGN1 = "nl"; +static const char stty_ek [] ALIGN1 = "ek"; +static const char stty_sane [] ALIGN1 = "sane"; +static const char cbreak [] ALIGN1 = "cbreak"; +static const char stty_pass8[] ALIGN1 = "pass8"; +static const char litout [] ALIGN1 = "litout"; +static const char cooked [] ALIGN1 = "cooked"; +static const char decctlq [] ALIGN1 = "decctlq"; +static const char stty_tabs [] ALIGN1 = "tabs"; +static const char stty_lcase[] ALIGN1 = "lcase"; +static const char stty_LCASE[] ALIGN1 = "LCASE"; +static const char stty_crt [] ALIGN1 = "crt"; +static const char stty_dec [] ALIGN1 = "dec"; /* Flags for 'struct mode_info' */ #define SANE_SET 1 /* Set in 'sane' mode */ @@ -158,7 +158,7 @@ static const char stty_dec [] = "dec"; /* Each mode */ struct mode_info { - const char * const name; /* Name given on command line */ + const char *const name; /* Name given on command line */ const unsigned char type; /* Which structure element to change */ const unsigned char flags; /* Setting and display options */ /* were using short here, but ppc32 was unhappy: */ @@ -324,7 +324,7 @@ enum { /* Control character settings */ struct control_info { - const char * const name; /* Name given on command line */ + const char *const name; /* Name given on command line */ const unsigned char saneval; /* Value to set for 'stty sane' */ const unsigned char offset; /* Offset in c_cc */ }; @@ -417,11 +417,11 @@ static const char *visible(unsigned ch) static tcflag_t *mode_type_flag(unsigned type, const struct termios *mode) { - static const unsigned char tcflag_offsets[] = { + static const unsigned char tcflag_offsets[] ALIGN1 = { offsetof(struct termios, c_cflag), /* control */ offsetof(struct termios, c_iflag), /* input */ offsetof(struct termios, c_oflag), /* output */ - offsetof(struct termios, c_lflag), /* local */ + offsetof(struct termios, c_lflag) /* local */ }; if (type <= local) { @@ -430,7 +430,7 @@ static tcflag_t *mode_type_flag(unsigned type, const struct termios *mode) return NULL; } -static void set_speed_or_die(enum speed_setting type, const char * const arg, +static void set_speed_or_die(enum speed_setting type, const char *const arg, struct termios * const mode) { speed_t baud; @@ -560,9 +560,9 @@ enum { param_ospeed = 8 | 0x80, }; -static int find_param(const char * const name) +static int find_param(const char *const name) { - static const char params[] = + static const char params[] ALIGN1 = "line\0" /* 1 */ "rows\0" /* 2 */ "cols\0" /* 3 */ diff --git a/coreutils/tail.c b/coreutils/tail.c index 0146916..ec21c42 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -63,7 +63,7 @@ static ssize_t tail_read(int fd, char *buf, size_t count) return r; } -static const char header_fmt[] = "\n==> %s <==\n"; +static const char header_fmt[] ALIGN1 = "\n==> %s <==\n"; static unsigned eat_num(const char *p) { diff --git a/coreutils/tr.c b/coreutils/tr.c index 5945718..6a34e30 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -52,7 +52,7 @@ static unsigned int expand(const char *arg, char *buffer) unsigned i; /* XXX: FIXME: use unsigned char? */ unsigned char ac; #define CLO ":]\0" - static const char classes[] = + static const char classes[] ALIGN1 = "alpha"CLO "alnum"CLO "digit"CLO "lower"CLO "upper"CLO "space"CLO "blank"CLO "punct"CLO "cntrl"CLO; #define CLASS_invalid 0 /* we increment the retval */ diff --git a/coreutils/uname.c b/coreutils/uname.c index a934c15..8f07f19 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c @@ -38,8 +38,8 @@ typedef struct { char processor[8]; /* for "unknown" */ } uname_info_t; -static const char options[] = "snrvmpa"; -static const unsigned short int utsname_offset[] = { +static const char options[] ALIGN1 = "snrvmpa"; +static const unsigned short utsname_offset[] ALIGN2 = { offsetof(uname_info_t,name.sysname), offsetof(uname_info_t,name.nodename), offsetof(uname_info_t,name.release), diff --git a/coreutils/uniq.c b/coreutils/uniq.c index adc196b..a7caef9 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c @@ -12,7 +12,7 @@ #include "libbb.h" -static const char uniq_opts[] = "cdu" "f:s:" "cdu\0\1\2\4"; +static const char uniq_opts[] ALIGN1 = "cdu" "f:s:" "cdu\0\1\2\4"; static FILE *xgetoptfile_uniq_s(char **argv, int read0write2) { diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index 8a1f38a..5066742 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c @@ -35,7 +35,7 @@ #include "libbb.h" #if ENABLE_FEATURE_RUN_PARTS_LONG_OPTIONS -static const char runparts_longopts[] = +static const char runparts_longopts[] ALIGN1 = "arg\0" Required_argument "a" "umask\0" Required_argument "u" "test\0" No_argument "t" diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index cf79270..f24168e 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c @@ -192,7 +192,7 @@ static int do_stop(void) } #if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS -static const char start_stop_daemon_longopts[] = +static const char start_stop_daemon_longopts[] ALIGN1 = "stop\0" No_argument "K" "start\0" No_argument "S" "background\0" No_argument "b" diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index 0ac0373..35424f8 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c @@ -38,7 +38,7 @@ struct globals { static unsigned long get_flag(char c) { /* Two separate vectors take less space than vector of structs */ - static const char flags_letter[] = "ASDacdijsutT"; + static const char flags_letter[] ALIGN1 = "ASDacdijsutT"; static const unsigned long flags_val[] = { /* A */ EXT2_NOATIME_FL, /* S */ EXT2_SYNC_FL, diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index eb1fa84..dfcbf67 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -79,7 +79,7 @@ struct fsck_instance { char *base_device; /* /dev/hda for /dev/hdaN etc */ }; -static const char ignored_types[] = +static const char ignored_types[] ALIGN1 = "ignore\0" "iso9660\0" "nfs\0" @@ -90,7 +90,7 @@ static const char ignored_types[] = "devpts\0"; #if 0 -static const char really_wanted[] = +static const char really_wanted[] ALIGN1 = "minix\0" "ext2\0" "ext3\0" diff --git a/e2fsprogs/old_e2fsprogs/blkid/probe.c b/e2fsprogs/old_e2fsprogs/blkid/probe.c index 8c6e2aa..453b4d0 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/probe.c +++ b/e2fsprogs/old_e2fsprogs/blkid/probe.c @@ -379,7 +379,7 @@ static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), { int j, bs; struct iso_volume_descriptor isosb; - const char * const * m; + const char *const *m; /* determine the block size by scanning in 2K increments (block sizes larger than 2K will be null padded) */ diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index efb8700..3d5b4f4 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -2168,7 +2168,7 @@ static int e2fsck_run_ext3_journal(e2fsck_t ctx) * This function will move the journal inode from a visible file in * the filesystem directory hierarchy to the reserved inode if necessary. */ -static const char * const journal_names[] = { +static const char *const journal_names[] = { ".journal", "journal", ".journal.dat", "journal.dat", 0 }; static void e2fsck_move_ext3_journal(e2fsck_t ctx) @@ -2179,7 +2179,7 @@ static void e2fsck_move_ext3_journal(e2fsck_t ctx) ext2_filsys fs = ctx->fs; ext2_ino_t ino; errcode_t retval; - const char * const * cpp; + const char *const * cpp; int group, mount_flags; clear_problem_context(&pctx); @@ -2372,7 +2372,7 @@ err_out: * abbreviation of the form '@<i>' is expanded by looking up the index * letter <i> in the table below. */ -static const char * const abbrevs[] = { +static const char *const abbrevs[] = { N_("aextended attribute"), N_("Aerror allocating"), N_("bblock"), @@ -2410,7 +2410,7 @@ static const char * const abbrevs[] = { * Give more user friendly names to the "special" inodes. */ #define num_special_inodes 11 -static const char * const special_inode_name[] = +static const char *const special_inode_name[] = { N_("<The NULL inode>"), /* 0 */ N_("<The bad blocks inode>"), /* 1 */ @@ -2485,7 +2485,7 @@ static void expand_at_expression(e2fsck_t ctx, char ch, struct problem_context *pctx, int *first) { - const char * const *cpp; + const char *const *cpp; const char *str; /* Search for the abbreviation */ @@ -8178,7 +8178,7 @@ struct latch_descr { * These are the prompts which are used to ask the user if they want * to fix a problem. */ -static const char * const prompt[] = { +static const char *const prompt[] = { N_("(no prompt)"), /* 0 */ N_("Fix"), /* 1 */ N_("Clear"), /* 2 */ @@ -8206,7 +8206,7 @@ static const char * const prompt[] = { * These messages are printed when we are preen mode and we will be * automatically fixing the problem. */ -static const char * const preen_msg[] = { +static const char *const preen_msg[] = { N_("(NONE)"), /* 0 */ N_("FIXED"), /* 1 */ N_("CLEARED"), /* 2 */ diff --git a/e2fsprogs/old_e2fsprogs/e2p/ostype.c b/e2fsprogs/old_e2fsprogs/e2p/ostype.c index 0e111d4..1abe2ba 100644 --- a/e2fsprogs/old_e2fsprogs/e2p/ostype.c +++ b/e2fsprogs/old_e2fsprogs/e2p/ostype.c @@ -12,7 +12,7 @@ #include <string.h> #include <stdlib.h> -static const char * const os_tab[] = +static const char *const os_tab[] = { "Linux", "Hurd", "Masix", @@ -42,7 +42,7 @@ char *e2p_os2string(int os_type) */ int e2p_string2os(char *str) { - const char * const *cpp; + const char *const *cpp; int i = 0; for (cpp = os_tab; *cpp; cpp++, i++) { diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index cf39807..2617837 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c @@ -115,7 +115,7 @@ struct fsck_instance { * Required for the uber-silly devfs /dev/ide/host1/bus2/target3/lun3 * pathames. */ -static const char * const devfs_hier[] = { +static const char *const devfs_hier[] = { "host", "bus", "target", "lun", 0 }; #endif @@ -124,7 +124,7 @@ static char *base_device(const char *device) { char *str, *cp; #ifdef CONFIG_FEATURE_DEVFS - const char * const *hier; + const char *const *hier; const char *disk; int len; #endif @@ -226,7 +226,7 @@ errout: } -static const char * const ignored_types[] = { +static const char *const ignored_types[] = { "ignore", "iso9660", "nfs", @@ -238,7 +238,7 @@ static const char * const ignored_types[] = { NULL }; -static const char * const really_wanted[] = { +static const char *const really_wanted[] = { "minix", "ext2", "ext3", diff --git a/editors/awk.c b/editors/awk.c index 752c73e..4ec3d46 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -263,7 +263,7 @@ enum { #define OC_B OC_BUILTIN -static const char tokenlist[] = +static const char tokenlist[] ALIGN1 = "\1(" NTC "\1)" NTC "\1/" NTC /* REGEXP */ @@ -373,7 +373,7 @@ enum { ENVIRON, F0, NUM_INTERNAL_VARS }; -static const char vNames[] = +static const char vNames[] ALIGN1 = "CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0" "ORS\0" "RS\0*" "RT\0" "FILENAME\0" "SUBSEP\0" "ARGIND\0" "ARGC\0" "ARGV\0" @@ -381,16 +381,15 @@ static const char vNames[] = "NR\0" "NF\0*" "IGNORECASE\0*" "ENVIRON\0" "$\0*" "\0"; -static const char vValues[] = +static const char vValues[] ALIGN1 = "%.6g\0" "%.6g\0" " \0" " \0" "\n\0" "\n\0" "\0" "\0" "\034\0" "\377"; /* hash size may grow to these values */ -#define FIRST_PRIME 61; -static const unsigned PRIMES[] = { 251, 1021, 4093, 16381, 65521 }; - +#define FIRST_PRIME 61 +static const uint16_t PRIMES[] ALIGN2 = { 251, 1021, 4093, 16381, 65521 }; /* Globals. Split in two parts so that first one is addressed @@ -504,17 +503,17 @@ static int awk_exit(int) ATTRIBUTE_NORETURN; /* ---- error handling ---- */ -static const char EMSG_INTERNAL_ERROR[] = "Internal error"; -static const char EMSG_UNEXP_EOS[] = "Unexpected end of string"; -static const char EMSG_UNEXP_TOKEN[] = "Unexpected token"; -static const char EMSG_DIV_BY_ZERO[] = "Division by zero"; -static const char EMSG_INV_FMT[] = "Invalid format specifier"; -static const char EMSG_TOO_FEW_ARGS[] = "Too few arguments for builtin"; -static const char EMSG_NOT_ARRAY[] = "Not an array"; -static const char EMSG_POSSIBLE_ERROR[] = "Possible syntax error"; -static const char EMSG_UNDEF_FUNC[] = "Call to undefined function"; +static const char EMSG_INTERNAL_ERROR[] ALIGN1 = "Internal error"; +static const char EMSG_UNEXP_EOS[] ALIGN1 = "Unexpected end of string"; +static const char EMSG_UNEXP_TOKEN[] ALIGN1 = "Unexpected token"; +static const char EMSG_DIV_BY_ZERO[] ALIGN1 = "Division by zero"; +static const char EMSG_INV_FMT[] ALIGN1 = "Invalid format specifier"; +static const char EMSG_TOO_FEW_ARGS[] ALIGN1 = "Too few arguments for builtin"; +static const char EMSG_NOT_ARRAY[] ALIGN1 = "Not an array"; +static const char EMSG_POSSIBLE_ERROR[] ALIGN1 = "Possible syntax error"; +static const char EMSG_UNDEF_FUNC[] ALIGN1 = "Call to undefined function"; #if !ENABLE_FEATURE_AWK_MATH -static const char EMSG_NO_MATH[] = "Math support is not compiled in"; +static const char EMSG_NO_MATH[] ALIGN1 = "Math support is not compiled in"; #endif static void zero_out_var(var * vp) @@ -522,8 +521,8 @@ static void zero_out_var(var * vp) memset(vp, 0, sizeof(*vp)); } -static void syntax_error(const char * const message) ATTRIBUTE_NORETURN; -static void syntax_error(const char * const message) +static void syntax_error(const char *const message) ATTRIBUTE_NORETURN; +static void syntax_error(const char *const message) { bb_error_msg_and_die("%s:%i: %s", g_progname, g_lineno, message); } @@ -825,7 +824,7 @@ static var *copyvar(var *dest, const var *src) static var *incvar(var *v) { - return setvar_i(v, getvar_i(v)+1.); + return setvar_i(v, getvar_i(v) + 1.); } /* return true if v is number or numeric string */ diff --git a/editors/cmp.c b/editors/cmp.c index da431f3..ffdfb91 100644 --- a/editors/cmp.c +++ b/editors/cmp.c @@ -33,12 +33,12 @@ static FILE *cmp_xfopen_input(const char *filename) xfunc_die(); /* We already output an error message. */ } -static const char fmt_eof[] = "cmp: EOF on %s\n"; -static const char fmt_differ[] = "%s %s differ: char %"OFF_FMT"d, line %d\n"; +static const char fmt_eof[] ALIGN1 = "cmp: EOF on %s\n"; +static const char fmt_differ[] ALIGN1 = "%s %s differ: char %"OFF_FMT"d, line %d\n"; // This fmt_l_opt uses gnu-isms. SUSv3 would be "%.0s%.0s%"OFF_FMT"d %o %o\n" -static const char fmt_l_opt[] = "%.0s%.0s%"OFF_FMT"d %3o %3o\n"; +static const char fmt_l_opt[] ALIGN1 = "%.0s%.0s%"OFF_FMT"d %3o %3o\n"; -static const char opt_chars[] = "sl"; +static const char opt_chars[] ALIGN1 = "sl"; #define CMP_OPT_s (1<<0) #define CMP_OPT_l (1<<1) diff --git a/editors/diff.c b/editors/diff.c index 88f8b22..41808b1 100644 --- a/editors/diff.c +++ b/editors/diff.c @@ -166,7 +166,7 @@ static void print_only(const char *path, size_t dirlen, const char *entry) static void print_status(int val, char *path1, char *path2, char *entry) { - const char * const _entry = entry ? entry : ""; + const char *const _entry = entry ? entry : ""; char * const _path1 = entry ? concat_path_file(path1, _entry) : path1; char * const _path2 = entry ? concat_path_file(path2, _entry) : path2; diff --git a/editors/sed.c b/editors/sed.c index 4647079..01ef93c 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -89,7 +89,7 @@ typedef struct sed_cmd_s { char cmd; /* The command char: abcdDgGhHilnNpPqrstwxy:={} */ } sed_cmd_t; -static const char semicolon_whitespace[] = "; \n\r\t\v"; +static const char semicolon_whitespace[] ALIGN1 = "; \n\r\t\v"; struct globals { /* options */ diff --git a/editors/vi.c b/editors/vi.c index c4f3a83..7456649 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -62,18 +62,18 @@ enum { /* vt102 typical ESC sequence */ /* terminal standout start/normal ESC sequence */ -static const char SOs[] = "\033[7m"; -static const char SOn[] = "\033[0m"; +static const char SOs[] ALIGN1 = "\033[7m"; +static const char SOn[] ALIGN1 = "\033[0m"; /* terminal bell sequence */ -static const char bell[] = "\007"; +static const char bell[] ALIGN1 = "\007"; /* Clear-end-of-line and Clear-end-of-screen ESC sequence */ -static const char Ceol[] = "\033[0K"; -static const char Ceos [] = "\033[0J"; +static const char Ceol[] ALIGN1 = "\033[0K"; +static const char Ceos[] ALIGN1 = "\033[0J"; /* Cursor motion arbitrary destination ESC sequence */ -static const char CMrc[] = "\033[%d;%dH"; +static const char CMrc[] ALIGN1 = "\033[%d;%dH"; /* Cursor motion up and down ESC sequence */ -static const char CMup[] = "\033[A"; -static const char CMdown[] = "\n"; +static const char CMup[] ALIGN1 = "\033[A"; +static const char CMdown[] ALIGN1 = "\n"; enum { @@ -2663,7 +2663,7 @@ static void ni(const char * s) // display messages static int format_edit_status(void) // show file status on status line { static int tot; - static const char cmd_mode_indicator[] = "-IR-"; + static const char cmd_mode_indicator[] ALIGN1 = "-IR-"; int cur, percent, ret, trunc_at; // file_modified is now a counter rather than a flag. this diff --git a/findutils/find.c b/findutils/find.c index 47cba7c..ea789a0 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -470,7 +470,7 @@ static action*** parse_params(char **argv) USE_FEATURE_FIND_CONTEXT(PARM_context ,) }; - static const char params[] = + static const char params[] ALIGN1 = "-a\0" "-o\0" USE_FEATURE_FIND_NOT( "!\0" ) @@ -794,7 +794,7 @@ static action*** parse_params(char **argv) int find_main(int argc, char **argv); int find_main(int argc, char **argv) { - static const char options[] = + static const char options[] ALIGN1 = "-follow\0" USE_FEATURE_FIND_XDEV( "-xdev\0" ) USE_FEATURE_FIND_MAXDEPTH("-maxdepth\0") diff --git a/include/platform.h b/include/platform.h index dcdb5c8..ff23ca1 100644 --- a/include/platform.h +++ b/include/platform.h @@ -169,7 +169,7 @@ __extension__ typedef unsigned long long __u64; # error "Sorry, this libc version is not supported :(" #endif -// Don't perpetuate e2fsck crap into the headers. Clean up e2fsck instead. +/* Don't perpetuate e2fsck crap into the headers. Clean up e2fsck instead. */ #if defined __GLIBC__ || defined __UCLIBC__ \ || defined __dietlibc__ || defined _NEWLIB_VERSION @@ -210,6 +210,16 @@ typedef unsigned smalluint; #include <stdbool.h> #endif +/* Try to defeat gcc's alignment of "char message[]"-like data */ +#if 1 /* if needed: !defined(arch1) && !defined(arch2) */ +#define ALIGN1 __attribute__((aligned(1))) +#define ALIGN2 __attribute__((aligned(2))) +#else +/* Arches which MUST have 2 or 4 byte alignment for everything are here */ +#define ALIGN1 +#define ALIGN2 +#endif + /* uclibc does not implement daemon() for no-mmu systems. * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. @@ -289,7 +299,7 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c) #if defined(__linux__) #include <sys/mount.h> -// Make sure we have all the new mount flags we actually try to use. +/* Make sure we have all the new mount flags we actually try to use. */ #ifndef MS_BIND #define MS_BIND (1<<12) #endif @@ -303,7 +313,7 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c) #define MS_SILENT (1<<15) #endif -// The shared subtree stuff, which went in around 2.6.15 +/* The shared subtree stuff, which went in around 2.6.15. */ #ifndef MS_UNBINDABLE #define MS_UNBINDABLE (1<<17) #endif diff --git a/init/init.c b/init/init.c index 5c7efe2..a196ab3 100644 --- a/init/init.c +++ b/init/init.c @@ -106,7 +106,7 @@ enum { #endif }; -static const char * const environment[] = { +static const char *const environment[] = { "HOME=/", bb_PATH_root_path, "SHELL=/bin/sh", @@ -457,7 +457,7 @@ static pid_t run(const struct init_action *a) #if !defined(__UCLIBC__) || defined(__ARCH_HAS_MMU__) if (a->action & ASKFIRST) { - static const char press_enter[] = + static const char press_enter[] ALIGN1 = #ifdef CUSTOMIZED_BANNER #include CUSTOMIZED_BANNER #endif @@ -923,7 +923,7 @@ int init_main(int argc, char **argv) chdir("/"); setsid(); { - const char * const *e; + const char *const *e; /* Make sure environs is set to something sane */ for (e = environment; *e; e++) putenv((char *) *e); diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index e873d7c..731d3d8 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c @@ -7,7 +7,7 @@ /* returns the array index of the string */ /* (index of first match is returned, or -1) */ -int index_in_str_array(const char * const string_array[], const char *key) +int index_in_str_array(const char *const string_array[], const char *key) { int i; @@ -36,7 +36,7 @@ int index_in_strings(const char *strings, const char *key) /* returns the array index of the string, even if it matches only a beginning */ /* (index of first match is returned, or -1) */ #ifdef UNUSED -int index_in_substr_array(const char * const string_array[], const char *key) +int index_in_substr_array(const char *const string_array[], const char *key) { int i; int len = strlen(key); diff --git a/libbb/dump.c b/libbb/dump.c index 5ddbbaa..0d1bb18 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -26,12 +26,12 @@ static int exitval; /* final exit value */ int bb_dump_blocksize; /* data block size */ int bb_dump_length = -1; /* max bytes to read */ -static const char index_str[] = ".#-+ 0123456789"; +static const char index_str[] ALIGN1 = ".#-+ 0123456789"; -static const char size_conv_str[] = +static const char size_conv_str[] ALIGN1 = "\x1\x4\x4\x4\x4\x4\x4\x8\x8\x8\x8\010cdiouxXeEfgG"; -static const char lcc[] = "diouxX"; +static const char lcc[] ALIGN1 = "diouxX"; int bb_dump_size(FS * fs) { @@ -440,7 +440,7 @@ static void bpad(PR * pr) while ((*p2++ = *p1++) != 0); } -static const char conv_str[] = +static const char conv_str[] ALIGN1 = "\0\\0\0" "\007\\a\0" /* \a */ "\b\\b\0" @@ -479,7 +479,7 @@ static void conv_c(PR * pr, unsigned char * p) static void conv_u(PR * pr, unsigned char * p) { - static const char list[] = + static const char list[] ALIGN1 = "nul\0soh\0stx\0etx\0eot\0enq\0ack\0bel\0" "bs\0_ht\0_lf\0_vt\0_ff\0_cr\0_so\0_si\0_" "dle\0dcl\0dc2\0dc3\0dc4\0nak\0syn\0etb\0" diff --git a/libbb/getopt32.c b/libbb/getopt32.c index c7c8cb7..672d70a 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c @@ -76,7 +76,7 @@ const char *applet_long_options This struct allows you to define long options: - static const char applet_longopts[] = + static const char applet_longopts[] ALIGN1 = //"name\0" has_arg val "verbose\0" No_argument "v" ; diff --git a/libbb/human_readable.c b/libbb/human_readable.c index 09fa82c..d60ef61 100644 --- a/libbb/human_readable.c +++ b/libbb/human_readable.c @@ -31,12 +31,12 @@ const char *make_human_readable_str(unsigned long long size, unsigned long block_size, unsigned long display_unit) { - /* The code will adjust for additional (appended) units. */ - static const char zero_and_units[] = { '0', 0, 'k', 'M', 'G', 'T' }; - static const char fmt[] = "%llu"; - static const char fmt_tenths[] = "%llu.%d%c"; + /* The code will adjust for additional (appended) units */ + static const char zero_and_units[] ALIGN1 = { '0', 0, 'k', 'M', 'G', 'T' }; + static const char fmt[] ALIGN1 = "%llu"; + static const char fmt_tenths[] ALIGN1 = "%llu.%d%c"; - static char str[21]; /* Sufficient for 64 bit unsigned integers. */ + static char str[21] ALIGN1; /* Sufficient for 64 bit unsigned integers */ unsigned long long val; int frac; @@ -53,7 +53,7 @@ const char *make_human_readable_str(unsigned long long size, } if (display_unit) { - val += display_unit/2; /* Deal with rounding. */ + val += display_unit/2; /* Deal with rounding */ val /= display_unit; /* Don't combine with the line above!!! */ } else { ++u; diff --git a/libbb/login.c b/libbb/login.c index 1cbadd2..308e1bf 100644 --- a/libbb/login.c +++ b/libbb/login.c @@ -15,8 +15,8 @@ #define LOGIN " login: " -static const char fmtstr_d[] = "%A, %d %B %Y"; -static const char fmtstr_t[] = "%H:%M:%S"; +static const char fmtstr_d[] ALIGN1 = "%A, %d %B %Y"; +static const char fmtstr_t[] ALIGN1 = "%H:%M:%S"; void print_login_issue(const char *issue_file, const char *tty) { diff --git a/libbb/md5.c b/libbb/md5.c index e672559..9de37b9 100644 --- a/libbb/md5.c +++ b/libbb/md5.c @@ -75,7 +75,7 @@ static void md5_hash_block(const void *buffer, md5_ctx_t *ctx) 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 }; - static const char P_array[] = { + static const char P_array[] ALIGN1 = { # if MD5_SIZE_VS_SPEED > 1 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 1 */ # endif /* MD5_SIZE_VS_SPEED > 1 */ @@ -85,7 +85,7 @@ static void md5_hash_block(const void *buffer, md5_ctx_t *ctx) }; # if MD5_SIZE_VS_SPEED > 1 - static const char S_array[] = { + static const char S_array[] ALIGN1 = { 7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, diff --git a/libbb/messages.c b/libbb/messages.c index 8cab2dc..c4052b1 100644 --- a/libbb/messages.c +++ b/libbb/messages.c @@ -12,34 +12,34 @@ #else #define BANNER "BusyBox v" BB_VER " (" BB_EXTRA_VERSION ")" #endif -const char bb_banner[] = BANNER; - -const char bb_msg_memory_exhausted[] = "memory exhausted"; -const char bb_msg_invalid_date[] = "invalid date '%s'"; -const char bb_msg_write_error[] = "write error"; -const char bb_msg_read_error[] = "read error"; -const char bb_msg_unknown[] = "(unknown)"; -const char bb_msg_can_not_create_raw_socket[] = "can't create raw socket"; -const char bb_msg_perm_denied_are_you_root[] = "permission denied. (are you root?)"; -const char bb_msg_requires_arg[] = "%s requires an argument"; -const char bb_msg_invalid_arg[] = "invalid argument '%s' to '%s'"; -const char bb_msg_standard_input[] = "standard input"; -const char bb_msg_standard_output[] = "standard output"; - -const char bb_str_default[] = "default"; -const char bb_hexdigits_upcase[] = "0123456789ABCDEF"; - -const char bb_path_passwd_file[] = "/etc/passwd"; -const char bb_path_shadow_file[] = "/etc/shadow"; -const char bb_path_group_file[] = "/etc/group"; -const char bb_path_gshadow_file[] = "/etc/gshadow"; -const char bb_path_motd_file[] = "/etc/motd"; -const char bb_dev_null[] = "/dev/null"; -const char bb_busybox_exec_path[] = CONFIG_BUSYBOX_EXEC_PATH; -const char bb_default_login_shell[] = LIBBB_DEFAULT_LOGIN_SHELL; +const char bb_banner[] ALIGN1 = BANNER; + +const char bb_msg_memory_exhausted[] ALIGN1 = "memory exhausted"; +const char bb_msg_invalid_date[] ALIGN1 = "invalid date '%s'"; +const char bb_msg_write_error[] ALIGN1 = "write error"; +const char bb_msg_read_error[] ALIGN1 = "read error"; +const char bb_msg_unknown[] ALIGN1 = "(unknown)"; +const char bb_msg_can_not_create_raw_socket[] ALIGN1 = "can't create raw socket"; +const char bb_msg_perm_denied_are_you_root[] ALIGN1 = "permission denied. (are you root?)"; +const char bb_msg_requires_arg[] ALIGN1 = "%s requires an argument"; +const char bb_msg_invalid_arg[] ALIGN1 = "invalid argument '%s' to '%s'"; +const char bb_msg_standard_input[] ALIGN1 = "standard input"; +const char bb_msg_standard_output[] ALIGN1 = "standard output"; + +const char bb_str_default[] ALIGN1 = "default"; +const char bb_hexdigits_upcase[] ALIGN1 = "0123456789ABCDEF"; + +const char bb_path_passwd_file[] ALIGN1 = "/etc/passwd"; +const char bb_path_shadow_file[] ALIGN1 = "/etc/shadow"; +const char bb_path_group_file[] ALIGN1 = "/etc/group"; +const char bb_path_gshadow_file[] ALIGN1 = "/etc/gshadow"; +const char bb_path_motd_file[] ALIGN1 = "/etc/motd"; +const char bb_dev_null[] ALIGN1 = "/dev/null"; +const char bb_busybox_exec_path[] ALIGN1 = CONFIG_BUSYBOX_EXEC_PATH; +const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL; /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, * but I want to save a few bytes here. Check libbb.h before changing! */ -const char bb_PATH_root_path[] = "PATH=/sbin:/usr/sbin:/bin:/usr/bin"; +const char bb_PATH_root_path[] ALIGN1 = "PATH=/sbin:/usr/sbin:/bin:/usr/bin"; const int const_int_0; @@ -47,7 +47,7 @@ const int const_int_1 = 1; #include <utmp.h> /* This is usually something like "/var/adm/wtmp" or "/var/log/wtmp" */ -const char bb_path_wtmp_file[] = +const char bb_path_wtmp_file[] ALIGN1 = #if defined _PATH_WTMP _PATH_WTMP; #elif defined WTMP_FILE diff --git a/libbb/mode_string.c b/libbb/mode_string.c index d3ff183..d17cc4a 100644 --- a/libbb/mode_string.c +++ b/libbb/mode_string.c @@ -47,9 +47,9 @@ static const mode_t mode_flags[] = { /* The previous version used "0pcCd?bB-?l?s???". However, the '0', 'C', * and 'B' types don't appear to be available on linux. So I removed them. */ -static const char type_chars[16] = "?pc?d?b?-?l?s???"; +static const char type_chars[16] ALIGN1 = "?pc?d?b?-?l?s???"; /* 0123456789abcdef */ -static const char mode_chars[7] = "rwxSTst"; +static const char mode_chars[7] ALIGN1 = "rwxSTst"; const char *bb_mode_string(mode_t mode) { diff --git a/libbb/mtab_file.c b/libbb/mtab_file.c index d00405d..030b148 100644 --- a/libbb/mtab_file.c +++ b/libbb/mtab_file.c @@ -11,5 +11,5 @@ /* Busybox mount uses either /proc/mounts or /etc/mtab to * get the list of currently mounted filesystems */ -const char bb_path_mtab_file[] = +const char bb_path_mtab_file[] ALIGN1 = USE_FEATURE_MTAB_SUPPORT("/etc/mtab")SKIP_FEATURE_MTAB_SUPPORT("/proc/mounts"); diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index a31bd4b..fd54900 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c @@ -31,8 +31,8 @@ int bb_parse_mode(const char *s, mode_t *current_mode) S_ISUID | S_ISGID, /* s */ S_ISVTX /* t */ }; - static const char who_chars[] = "augo"; - static const char perm_chars[] = "rwxXst"; + static const char who_chars[] ALIGN1 = "augo"; + static const char perm_chars[] ALIGN1 = "rwxXst"; const char *p; mode_t wholist; diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c index 3178ad3..1cadbd3 100644 --- a/libbb/process_escape_sequence.c +++ b/libbb/process_escape_sequence.c @@ -18,7 +18,7 @@ char bb_process_escape_sequence(const char **ptr) { - static const char charmap[] = { + static const char charmap[] ALIGN1 = { 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', 0, '\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '\\' }; diff --git a/libbb/uuencode.c b/libbb/uuencode.c index f525322..0aedf33 100644 --- a/libbb/uuencode.c +++ b/libbb/uuencode.c @@ -8,7 +8,7 @@ #include "libbb.h" /* Conversion table. for base 64 */ -const char bb_uuenc_tbl_base64[65 + 2] = { +const char bb_uuenc_tbl_base64[65 + 2] ALIGN1 = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', @@ -21,7 +21,7 @@ const char bb_uuenc_tbl_base64[65 + 2] = { '\n', '\0' /* needed for uudecode.c */ }; -const char bb_uuenc_tbl_std[65] = { +const char bb_uuenc_tbl_std[65] ALIGN1 = { '`', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index b535ef5..7e7ff48 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c @@ -695,7 +695,8 @@ int putpwent(const struct passwd *__restrict p, FILE *__restrict f) int putgrent(const struct group *__restrict p, FILE *__restrict f) { - static const char format[] = ",%s"; + static const char format[] ALIGN1 = ",%s"; + char **m; const char *fmt; int rv = -1; @@ -735,18 +736,19 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) } #if ENABLE_USE_BB_SHADOW -static const unsigned char _sp_off[] = { - offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ - offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ - offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ - offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ - offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ - offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ +static const unsigned char _sp_off[] ALIGN1 = { + offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ + offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ + offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ + offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ + offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ + offsetof(struct spwd, sp_expire) /* 7 - not a char ptr */ }; int putspent(const struct spwd *p, FILE *stream) { - static const char ld_format[] = "%ld:"; + static const char ld_format[] ALIGN1 = "%ld:"; + const char *f; long x; int i; @@ -787,14 +789,14 @@ DO_UNLOCK: /* Internal uClibc functions. */ /**********************************************************************/ -static const unsigned char pw_off[] = { - offsetof(struct passwd, pw_name), /* 0 */ - offsetof(struct passwd, pw_passwd), /* 1 */ - offsetof(struct passwd, pw_uid), /* 2 - not a char ptr */ - offsetof(struct passwd, pw_gid), /* 3 - not a char ptr */ - offsetof(struct passwd, pw_gecos), /* 4 */ - offsetof(struct passwd, pw_dir), /* 5 */ - offsetof(struct passwd, pw_shell) /* 6 */ +static const unsigned char pw_off[] ALIGN1 = { + offsetof(struct passwd, pw_name), /* 0 */ + offsetof(struct passwd, pw_passwd), /* 1 */ + offsetof(struct passwd, pw_uid), /* 2 - not a char ptr */ + offsetof(struct passwd, pw_gid), /* 3 - not a char ptr */ + offsetof(struct passwd, pw_gecos), /* 4 */ + offsetof(struct passwd, pw_dir), /* 5 */ + offsetof(struct passwd, pw_shell) /* 6 */ }; static int bb__parsepwent(void *data, char *line) @@ -845,10 +847,10 @@ static int bb__parsepwent(void *data, char *line) /**********************************************************************/ -static const unsigned char gr_off[] = { - offsetof(struct group, gr_name), /* 0 */ - offsetof(struct group, gr_passwd), /* 1 */ - offsetof(struct group, gr_gid) /* 2 - not a char ptr */ +static const unsigned char gr_off[] ALIGN1 = { + offsetof(struct group, gr_name), /* 0 */ + offsetof(struct group, gr_passwd), /* 1 */ + offsetof(struct group, gr_gid) /* 2 - not a char ptr */ }; static int bb__parsegrent(void *data, char *line) @@ -943,16 +945,16 @@ static int bb__parsegrent(void *data, char *line) /**********************************************************************/ #if ENABLE_USE_BB_SHADOW -static const unsigned char sp_off[] = { - offsetof(struct spwd, sp_namp), /* 0 */ - offsetof(struct spwd, sp_pwdp), /* 1 */ - offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ - offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ - offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ - offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ - offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ - offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ - offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */ +static const unsigned char sp_off[] ALIGN1 = { + offsetof(struct spwd, sp_namp), /* 0 */ + offsetof(struct spwd, sp_pwdp), /* 1 */ + offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ + offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ + offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ + offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ + offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ + offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ + offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */ }; static int bb__parsespent(void *data, char * line) diff --git a/loginutils/adduser.c b/loginutils/adduser.c index 6c69aaf..79cd2f4 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c @@ -81,7 +81,8 @@ static void passwd_wrapper(const char *login) ATTRIBUTE_NORETURN; static void passwd_wrapper(const char *login) { - static const char prog[] = "passwd"; + static const char prog[] ALIGN1 = "passwd"; + BB_EXECLP(prog, prog, login, NULL); bb_error_msg_and_die("failed to execute '%s', you must set the password for '%s' manually", prog, login); } diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 3e02c8e..6fb4dca 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c @@ -11,7 +11,7 @@ #if ENABLE_GETOPT_LONG #include <getopt.h> -static const char chpasswd_longopts[] = +static const char chpasswd_longopts[] ALIGN1 = "encrypted\0" No_argument "e" "md5\0" No_argument "m" ; diff --git a/loginutils/getty.c b/loginutils/getty.c index 2fcb0d9..0254d32 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -93,7 +93,7 @@ struct options { int speeds[MAX_SPEED]; /* baud rates to be tried */ }; -static const char opt_string[] = "I:LH:f:hil:mt:wn"; +static const char opt_string[] ALIGN1 = "I:LH:f:hil:mt:wn"; #define F_INITSTRING (1<<0) /* initstring is set */ #define F_LOCAL (1<<1) /* force local */ #define F_FAKEHOST (1<<2) /* force fakehost */ diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 36b10fb..5638c4b 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -9,7 +9,7 @@ #include "libbb.h" -static const char * const forbid[] = { +static const char *const forbid[] = { "ENV", "BASH_ENV", "HOME", @@ -40,7 +40,7 @@ int sulogin_main(int argc, char **argv) char *cp; int timeout = 0; char *timeout_arg; - const char * const *p; + const char *const *p; struct passwd *pwd; const char *shell; #if ENABLE_FEATURE_SHADOWPASSWDS diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 9f8227c..1e6d15f 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c @@ -14,7 +14,10 @@ #include "libbb.h" #include <sys/timex.h> -static const struct {int bit; const char *name;} statlist[] = { +static const struct { + int bit; + const char *name; +} statlist[] = { { STA_PLL, "PLL" }, { STA_PPSFREQ, "PPSFREQ" }, { STA_PPSTIME, "PPSTIME" }, @@ -28,15 +31,17 @@ static const struct {int bit; const char *name;} statlist[] = { { STA_PPSWANDER, "PPSWANDER" }, { STA_PPSERROR, "PPSERROR" }, { STA_CLOCKERR, "CLOCKERR" }, - { 0, NULL } }; + { 0, NULL } +}; -static const char * const ret_code_descript[] = { +static const char *const ret_code_descript[] = { "clock synchronized", "insert leap second", "delete leap second", "leap second in progress", "leap second has occurred", - "clock not synchronized" }; + "clock not synchronized" +}; int adjtimex_main(int argc, char **argv); int adjtimex_main(int argc, char **argv) diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 848f2b3..6b31f36 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -245,12 +245,10 @@ static struct config_entry_struct *last_config = NULL; static char *mount_point = NULL; static volatile int caught_signal = FALSE; static volatile int caught_sighup = FALSE; -static struct initial_symlink_struct -{ +static struct initial_symlink_struct { const char *dest; const char *name; -} initial_symlinks[] = -{ +} initial_symlinks[] = { {"/proc/self/fd", "fd"}, {"fd/0", "stdin"}, {"fd/1", "stdout"}, @@ -258,12 +256,10 @@ static struct initial_symlink_struct {NULL, NULL}, }; -static struct event_type -{ +static struct event_type { unsigned int type; /* The DEVFSD_NOTIFY_* value */ const char *config_name; /* The name used in the config file */ -} event_types[] = -{ +} event_types[] = { {DEVFSD_NOTIFY_REGISTERED, "REGISTER"}, {DEVFSD_NOTIFY_UNREGISTERED, "UNREGISTER"}, {DEVFSD_NOTIFY_ASYNC_OPEN, "ASYNC_OPEN"}, @@ -277,10 +273,10 @@ static struct event_type /* Busybox messages */ -static const char * const bb_msg_proto_rev = "protocol revision"; -static const char * const bb_msg_bad_config = "bad %s config file: %s"; -static const char * const bb_msg_small_buffer = "buffer too small"; -static const char * const bb_msg_variable_not_found = "variable: %s not found"; +static const char bb_msg_proto_rev[] ALIGN1 = "protocol revision"; +static const char bb_msg_bad_config[] ALIGN1 = "bad %s config file: %s"; +static const char bb_msg_small_buffer[] ALIGN1 = "buffer too small"; +static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found"; /* Busybox stuff */ #if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG @@ -387,10 +383,10 @@ int devfsd_main(int argc, char **argv) /* NB: The check for CONFIG_FILE is done in read_config_file() */ - if (print_version ||(DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)) { + if (print_version || (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev)) { printf("%s v%s\nDaemon %s:\t%d\nKernel-side %s:\t%d\n", applet_name, DEVFSD_VERSION, bb_msg_proto_rev, - DEVFSD_PROTOCOL_REVISION_DAEMON,bb_msg_proto_rev, proto_rev); + DEVFSD_PROTOCOL_REVISION_DAEMON, bb_msg_proto_rev, proto_rev); if (DEVFSD_PROTOCOL_REVISION_DAEMON != proto_rev) bb_error_msg_and_die("%s mismatch!", bb_msg_proto_rev); exit(EXIT_SUCCESS); /* -v */ @@ -509,7 +505,7 @@ static void process_config_line(const char *line, unsigned long *event_mask) int i; /* !!!! Only Uppercase Keywords in devsfd.conf */ - static const char options[] = + static const char options[] ALIGN1 = "CLEAR_CONFIG\0""INCLUDE\0""OPTIONAL_INCLUDE\0" "RESTORE\0""PERMISSIONS\0""MODLOAD\0""EXECUTE\0" "COPY\0""IGNORE\0""MKOLDCOMPAT\0""MKNEWCOMPAT\0" diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 98cc04f..484c970 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -128,7 +128,7 @@ #define CDROM 0x0005 #if ENABLE_FEATURE_HDPARM_GET_IDENTITY -static const char * const pkt_str[] = { +static const char *const pkt_str[] = { "Direct-access device", /* word 0, bits 12-8 = 00 */ "Sequential-access device", /* word 0, bits 12-8 = 01 */ "Printer", /* word 0, bits 12-8 = 02 */ @@ -163,7 +163,7 @@ static const char * const pkt_str[] = { "Unknown", /* word 0, bits 12-8 = 1f */ }; -static const char * const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ +static const char *const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ "Reserved", /* bit 0 */ "hard sectored", /* bit 1 */ "soft sectored", /* bit 2 */ @@ -326,7 +326,7 @@ static const char actual_ver[MINOR_MAX+2] = { #define NUM_CMD_FEAT_STR 48 #if ENABLE_FEATURE_HDPARM_GET_IDENTITY -static const char * const cmd_feat_str[] = { +static const char *const cmd_feat_str[] = { "", /* word 82 bit 15: obsolete */ "NOP cmd", /* word 82 bit 14 */ "READ BUFFER cmd", /* word 82 bit 13 */ @@ -413,7 +413,7 @@ void identify_from_stdin(void); #define SECU_LEVEL 0x0010 #define NUM_SECU_STR 6 #if ENABLE_FEATURE_HDPARM_GET_IDENTITY -static const char * const secu_str[] = { +static const char *const secu_str[] = { "supported", /* word 128, bit 0 */ "enabled", /* word 128, bit 1 */ "locked", /* word 128, bit 2 */ @@ -1096,14 +1096,16 @@ static unsigned long hwif_irq; // Too bad, really. #if ENABLE_FEATURE_HDPARM_GET_IDENTITY -static const char * const cfg_str[] = -{ "", "HardSect", "SoftSect", "NotMFM", +static const char *const cfg_str[] = { + "", "HardSect", "SoftSect", "NotMFM", "HdSw>15uSec", "SpinMotCtl", "Fixed", "Removeable", "DTR<=5Mbs", "DTR>5Mbs", "DTR>10Mbs", "RotSpdTol>.5%", "dStbOff", "TrkOff", "FmtGapReq", "nonMagnetic" }; -static const char * const BuffType[] = {"Unknown", "1Sect", "DualPort", "DualPortCache"}; +static const char *const BuffType[] = { + "Unknown", "1Sect", "DualPort", "DualPortCache" +}; static void dump_identity(const struct hd_driveid *id) { @@ -1930,7 +1932,8 @@ static void parse_xfermode(int flag, smallint *get, smallint *set, int *value) } /*------- getopt short options --------*/ -static const char hdparm_options[] = "gfu::n::p:r::m::c::k::a::B:tTh" +static const char hdparm_options[] ALIGN1 = + "gfu::n::p:r::m::c::k::a::B:tTh" USE_FEATURE_HDPARM_GET_IDENTITY("iI") USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") #ifdef HDIO_DRIVE_CMD diff --git a/miscutils/less.c b/miscutils/less.c index a6649c5..046a3c4 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -450,12 +450,12 @@ static void cap_cur_fline(int nlines) } } -static const char controls[] = +static const char controls[] ALIGN1 = /* NUL: never encountered; TAB: not converted */ /**/"\x01\x02\x03\x04\x05\x06\x07\x08" "\x0a\x0b\x0c\x0d\x0e\x0f" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" "\x7f\x9b"; /* DEL and infamous Meta-ESC :( */ -static const char ctrlconv[] = +static const char ctrlconv[] ALIGN1 = /* '\n': it's a former NUL - subst with '@', not 'J' */ "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x40\x4b\x4c\x4d\x4e\x4f" "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"; diff --git a/miscutils/time.c b/miscutils/time.c index 9b7db66..e8473f7 100644 --- a/miscutils/time.c +++ b/miscutils/time.c @@ -23,15 +23,15 @@ typedef struct { #define UL unsigned long -static const char default_format[] = "real\t%E\nuser\t%u\nsys\t%T"; +static const char default_format[] ALIGN1 = "real\t%E\nuser\t%u\nsys\t%T"; /* The output format for the -p option .*/ -static const char posix_format[] = "real %e\nuser %U\nsys %S"; +static const char posix_format[] ALIGN1 = "real %e\nuser %U\nsys %S"; /* Format string for printing all statistics verbosely. Keep this output to 24 lines so users on terminals can see it all.*/ -static const char long_format[] = +static const char long_format[] ALIGN1 = "\tCommand being timed: \"%C\"\n" "\tUser time (seconds): %U\n" "\tSystem time (seconds): %S\n" diff --git a/modutils/insmod.c b/modutils/insmod.c index 8a6cc05..c0bc0eb 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -3613,12 +3613,12 @@ static int obj_gpl_license(struct obj_file *f, const char **license) * linux/include/linux/module.h. Checking for leading "GPL" will not * work, somebody will use "GPL sucks, this is proprietary". */ - static const char * const gpl_licenses[] = { + static const char *const gpl_licenses[] = { "GPL", "GPL v2", "GPL and additional rights", "Dual BSD/GPL", - "Dual MPL/GPL", + "Dual MPL/GPL" }; sec = obj_find_section(f, ".modinfo"); @@ -3681,7 +3681,8 @@ static void set_tainted(struct obj_file *f, int fd, char *m_name, /* Check if loading this module will taint the kernel. */ static void check_tainted_module(struct obj_file *f, char *m_name) { - static const char tainted_file[] = TAINT_FILENAME; + static const char tainted_file[] ALIGN1 = TAINT_FILENAME; + int fd, kernel_has_tainted; const char *ptr; @@ -3750,7 +3751,8 @@ static void add_ksymoops_symbols(struct obj_file *f, const char *filename, const char *m_name) { - static const char symprefix[] = "__insmod_"; + static const char symprefix[] ALIGN1 = "__insmod_"; + struct obj_section *sec; struct obj_symbol *sym; char *name, *absolute_filename; diff --git a/networking/arp.c b/networking/arp.c index 907433b..a5a7373 100644 --- a/networking/arp.c +++ b/networking/arp.c @@ -46,7 +46,7 @@ static int sockfd; /* active socket descriptor */ static smallint hw_set; /* flag if hw-type was set (-H) */ static const char *device = ""; /* current device */ -static const char options[] = +static const char options[] ALIGN1 = "pub\0" "priv\0" "temp\0" diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 02e7c52..f3d6009 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -287,7 +287,7 @@ int ftp_send(ftp_host_info_t *server, FILE *control_stream, #define FTPGETPUT_OPT_PORT 16 #if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS -static const char ftpgetput_longopts[] = +static const char ftpgetput_longopts[] ALIGN1 = "continue\0" Required_argument "c" "verbose\0" No_argument "v" "username\0" Required_argument "u" diff --git a/networking/httpd.c b/networking/httpd.c index fb3129f..b083d64 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -98,8 +98,8 @@ # define PIPE_BUF 4096 #endif -static const char default_path_httpd_conf[] = "/etc"; -static const char httpd_conf[] = "httpd.conf"; +static const char default_path_httpd_conf[] ALIGN1 = "/etc"; +static const char httpd_conf[] ALIGN1 = "httpd.conf"; #define TIMEOUT 60 @@ -202,9 +202,9 @@ struct globals { ContentLength = -1; \ } while (0) -static const char request_GET[] = "GET"; /* size algorithmic optimize */ +static const char request_GET[] ALIGN1 = "GET"; /* size algorithmic optimize */ -static const char* const suffixTable [] = { +static const char *const suffixTable[] = { /* Warning: shorted equivalent suffix in one line must be first */ ".htm.html", "text/html", ".jpg.jpeg", "image/jpeg", @@ -288,7 +288,7 @@ static const HttpEnumString httpResponseNames[] = { }; -static const char RFC1123FMT[] = "%a, %d %b %Y %H:%M:%S GMT"; +static const char RFC1123FMT[] ALIGN1 = "%a, %d %b %Y %H:%M:%S GMT"; #define STRNCASECMP(a, str) strncasecmp((a), (str), sizeof(str)-1) @@ -1268,7 +1268,7 @@ static int sendCgi(const char *url, * <cr><lf> pair here. We will output "200 OK" line * if needed, but CGI still has to provide blank line * between header and body */ - static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n"; + static const char HTTP_200[] ALIGN1 = "HTTP/1.0 200 OK\r\n"; /* Must use safe_read, not full_read, because * CGI may output a few first bytes and then wait @@ -1343,9 +1343,9 @@ static int sendCgi(const char *url, static int sendFile(const char *url) { char * suffix; - int f; - const char * const * table; - const char * try_suffix; + int f; + const char *const *table; + const char *try_suffix; suffix = strrchr(url, '.'); diff --git a/networking/interface.c b/networking/interface.c index 9e6ed63..61ce12e 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -871,7 +871,7 @@ static int hw_null_address(const struct hwtype *hw, void *ap) return 1; } -static const char TRext[] = "\0\0\0Ki\0Mi\0Gi\0Ti"; +static const char TRext[] ALIGN1 = "\0\0\0Ki\0Mi\0Gi\0Ti"; static void print_bytes_scaled(unsigned long long ull, const char *end) { @@ -1020,7 +1020,7 @@ static void ife_print(struct interface *ptr) if (ptr->flags == 0) { printf("[NO FLAGS] "); } else { - static const char ife_print_flags_strs[] = + static const char ife_print_flags_strs[] ALIGN1 = "UP\0" "BROADCAST\0" "DEBUG\0" @@ -1038,7 +1038,7 @@ static void ife_print(struct interface *ptr) "DYNAMIC\0" #endif ; - static const unsigned short ife_print_flags_mask[] = { + static const unsigned short ife_print_flags_mask[] ALIGN2 = { IFF_UP, IFF_BROADCAST, IFF_DEBUG, @@ -1051,9 +1051,9 @@ static void ife_print(struct interface *ptr) IFF_ALLMULTI, IFF_SLAVE, IFF_MASTER, - IFF_MULTICAST, + IFF_MULTICAST #ifdef HAVE_DYNAMIC - IFF_DYNAMIC, + ,IFF_DYNAMIC #endif }; const unsigned short *mask = ife_print_flags_mask; diff --git a/networking/ip.c b/networking/ip.c index bf7e84c..c82d731 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -82,7 +82,7 @@ int iptunnel_main(int argc, char **argv) int ip_main(int argc, char **argv); int ip_main(int argc, char **argv) { - static const char keywords[] = + static const char keywords[] ALIGN1 = USE_FEATURE_IP_ADDRESS("address\0") USE_FEATURE_IP_ROUTE("route\0") USE_FEATURE_IP_LINK("link\0") diff --git a/networking/ipcalc.c b/networking/ipcalc.c index f3e3ad9..2a099ef 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -63,7 +63,7 @@ int get_prefix(unsigned long netmask); #define SILENT 0x20 #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS - static const char ipcalc_longopts[] = + static const char ipcalc_longopts[] ALIGN1 = "netmask\0" No_argument "m" "broadcast\0" No_argument "b" "network\0" No_argument "n" diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c index 0e429a0..ff33399 100644 --- a/networking/libiproute/ip_parse_common_args.c +++ b/networking/libiproute/ip_parse_common_args.c @@ -26,7 +26,7 @@ void ip_parse_common_args(int *argcp, char ***argvp) { int argc = *argcp; char **argv = *argvp; - static const char ip_common_commands[] = + static const char ip_common_commands[] ALIGN1 = "-family\0""inet\0""inet6\0""link\0" "-4\0""-6\0""-0\0""-oneline\0"; enum { diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index 8874fdb..6a5f2cf 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -412,7 +412,7 @@ static void ipaddr_reset_filter(int _oneline) /* Return value becomes exitcode. It's okay to not return at all */ int ipaddr_list_or_flush(int argc, char **argv, int flush) { - static const char option[] = "to\0""scope\0""up\0""label\0""dev\0"; + static const char option[] ALIGN1 = "to\0""scope\0""up\0""label\0""dev\0"; struct nlmsg_list *linfo = NULL; struct nlmsg_list *ainfo = NULL; @@ -599,7 +599,7 @@ static int default_scope(inet_prefix *lcl) /* Return value becomes exitcode. It's okay to not return at all */ static int ipaddr_modify(int cmd, int argc, char **argv) { - static const char option[] = + static const char option[] ALIGN1 = "peer\0""remote\0""broadcast\0""brd\0" "anycast\0""scope\0""dev\0""label\0""local\0"; struct rtnl_handle rth; @@ -768,7 +768,7 @@ static int ipaddr_modify(int cmd, int argc, char **argv) /* Return value becomes exitcode. It's okay to not return at all */ int do_ipaddr(int argc, char **argv) { - static const char commands[] = + static const char commands[] ALIGN1 = "add\0""delete\0""list\0""show\0""lst\0""flush\0"; int command_num = 2; /* default command is list */ diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index 69ce84e..e1c9c60 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c @@ -171,7 +171,7 @@ static int do_set(int argc, char **argv) struct ifreq ifr0, ifr1; char *newname = NULL; int htype, halen; - static const char keywords[] = + static const char keywords[] ALIGN1 = "up\0""down\0""name\0""mtu\0""multicast\0""arp\0""addr\0""dev\0" "on\0""off\0"; enum { ARG_up = 1, ARG_down, ARG_name, ARG_mtu, ARG_multicast, ARG_arp, @@ -275,7 +275,7 @@ static int ipaddr_list_link(int argc, char **argv) /* Return value becomes exitcode. It's okay to not return at all */ int do_iplink(int argc, char **argv) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "set\0""show\0""lst\0""list\0"; smalluint key; if (argc <= 0) diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 0d171c7..fbc7210 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c @@ -294,7 +294,7 @@ static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED, /* Return value becomes exitcode. It's okay to not return at all */ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0") "dev\0""oif\0""to\0"; enum { @@ -489,7 +489,7 @@ static int rtnl_rtcache_request(struct rtnl_handle *rth, int family) static void iproute_flush_cache(void) { - static const char fn[] = "/proc/sys/net/ipv4/route/flush"; + static const char fn[] ALIGN1 = "/proc/sys/net/ipv4/route/flush"; int flush_fd = open_or_warn(fn, O_WRONLY); if (flush_fd < 0) { @@ -517,7 +517,7 @@ static int iproute_list_or_flush(int argc, char **argv, int flush) struct rtnl_handle rth; char *id = NULL; char *od = NULL; - static const char keywords[] = + static const char keywords[] ALIGN1 = "protocol\0""all\0""dev\0""oif\0""iif\0""via\0""table\0""cache\0" /*all*/ "from\0""root\0""match\0""exact\0""to\0"/*root match exact*/; enum { @@ -679,7 +679,7 @@ static int iproute_get(int argc, char **argv) char *odev = NULL; bool connected = 0; bool from_ok = 0; - static const char options[] = + static const char options[] ALIGN1 = "from\0""iif\0""oif\0""dev\0""notify\0""connected\0""to\0"; memset(&req, 0, sizeof(req)); @@ -824,7 +824,7 @@ static int iproute_get(int argc, char **argv) /* Return value becomes exitcode. It's okay to not return at all */ int do_iproute(int argc, char **argv) { - static const char ip_route_commands[] = + static const char ip_route_commands[] ALIGN1 = /*0-3*/ "add\0""append\0""change\0""chg\0" /*4-7*/ "delete\0""get\0""list\0""show\0" /*8..*/ "prepend\0""replace\0""test\0""flush\0"; diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c index 8e2a06f..18ae6b5 100644 --- a/networking/libiproute/iprule.c +++ b/networking/libiproute/iprule.c @@ -187,7 +187,7 @@ static int iprule_list(int argc, char **argv) /* Return value becomes exitcode. It's okay to not return at all */ static int iprule_modify(int cmd, int argc, char **argv) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "from\0""to\0""preference\0""order\0""priority\0" "tos\0""fwmark\0""realms\0""table\0""lookup\0""dev\0" "iif\0""nat\0""map-to\0""type\0""help\0"; @@ -313,7 +313,7 @@ static int iprule_modify(int cmd, int argc, char **argv) /* Return value becomes exitcode. It's okay to not return at all */ int do_iprule(int argc, char **argv) { - static const char ip_rule_commands[] = + static const char ip_rule_commands[] ALIGN1 = "add\0""delete\0""list\0""show\0"; int cmd = 2; /* list */ diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index a293387..2b17135 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c @@ -128,7 +128,7 @@ static int do_del_ioctl(const char *basedev, struct ip_tunnel_parm *p) /* Dies on error */ static void parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "mode\0""ipip\0""ip/ip\0""gre\0""gre/ip\0""sit\0""ipv6/ip\0" "key\0""ikey\0""okey\0""seq\0""iseq\0""oseq\0" "csum\0""icsum\0""ocsum\0""nopmtudisc\0""pmtudisc\0" @@ -519,7 +519,7 @@ static int do_show(int argc, char **argv) /* Return value becomes exitcode. It's okay to not return at all */ int do_iptunnel(int argc, char **argv) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "add\0""change\0""delete\0""show\0""list\0""lst\0"; enum { ARG_add = 0, ARG_change, ARG_del, ARG_show, ARG_list, ARG_lst }; int key; diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c index e8a8279..7b5de92 100644 --- a/networking/libiproute/ll_map.c +++ b/networking/libiproute/ll_map.c @@ -131,7 +131,7 @@ unsigned ll_index_to_flags(int idx) return 0; } -int xll_name_to_index(const char * const name) +int xll_name_to_index(const char *const name) { int ret = 0; int sock_fd; diff --git a/networking/libiproute/ll_map.h b/networking/libiproute/ll_map.h index 2dfc844..55e2cf3 100644 --- a/networking/libiproute/ll_map.h +++ b/networking/libiproute/ll_map.h @@ -4,7 +4,7 @@ int ll_remember_index(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg); int ll_init_map(struct rtnl_handle *rth); -int xll_name_to_index(const char * const name); +int xll_name_to_index(const char *const name); const char *ll_index_to_name(int idx); const char *ll_idx_n2a(int idx, char *buf); /* int ll_index_to_type(int idx); */ diff --git a/networking/libiproute/rtm_map.c b/networking/libiproute/rtm_map.c index 96b2d17..ca2f443 100644 --- a/networking/libiproute/rtm_map.c +++ b/networking/libiproute/rtm_map.c @@ -51,7 +51,7 @@ const char *rtnl_rtntype_n2a(int id, char *buf, int len) int rtnl_rtntype_a2n(int *id, char *arg) { - static const char keywords[] = + static const char keywords[] ALIGN1 = "local\0""nat\0""broadcast\0""brd\0""anycast\0" "multicast\0""prohibit\0""unreachable\0""blackhole\0" "xresolve\0""unicast\0""throw\0"; diff --git a/networking/netstat.c b/networking/netstat.c index 746e250..014e5e2 100644 --- a/networking/netstat.c +++ b/networking/netstat.c @@ -47,8 +47,7 @@ enum { TCP_CLOSING /* now a valid state */ }; -static const char * const tcp_state[] = -{ +static const char *const tcp_state[] = { "", "ESTABLISHED", "SYN_SENT", diff --git a/networking/route.c b/networking/route.c index 530c51b..bfa58da 100644 --- a/networking/route.c +++ b/networking/route.c @@ -73,7 +73,7 @@ #define HOST_FLAG 2 /* We remap '-' to '#' to avoid problems with getopt. */ -static const char tbl_hash_net_host[] = +static const char tbl_hash_net_host[] ALIGN1 = "\007\001#net\0" /* "\010\002#host\0" */ "\007\002#host" /* Since last, we can save a byte. */ @@ -96,7 +96,7 @@ static const char tbl_hash_net_host[] = #define KW_IPVx_DYN 042 #define KW_IPVx_REINSTATE 043 -static const char tbl_ipvx[] = +static const char tbl_ipvx[] ALIGN1 = /* 020 is the "takes an arg" bit */ #if HAVE_NEW_ADDRT "\011\020metric\0" @@ -438,7 +438,7 @@ static void INET6_setroute(int action, char **args) } #endif -static const unsigned int flagvals[] = { /* Must agree with flagchars[]. */ +static const unsigned flagvals[] = { /* Must agree with flagchars[]. */ RTF_GATEWAY, RTF_HOST, RTF_REINSTATE, @@ -454,7 +454,8 @@ static const unsigned int flagvals[] = { /* Must agree with flagchars[]. */ #define IPV4_MASK (RTF_GATEWAY|RTF_HOST|RTF_REINSTATE|RTF_DYNAMIC|RTF_MODIFIED) #define IPV6_MASK (RTF_GATEWAY|RTF_HOST|RTF_DEFAULT|RTF_ADDRCONF|RTF_CACHE) -static const char flagchars[] = /* Must agree with flagvals[]. */ +/* Must agree with flagvals[]. */ +static const char flagchars[] ALIGN1 = "GHRDM" #if ENABLE_FEATURE_IPV6 "DAC" @@ -631,11 +632,12 @@ static void INET6_displayroutes(int noresolve) #define ROUTE_OPT_INET6 0x08 /* Not an actual option. See below. */ /* 1st byte is offset to next entry offset. 2nd byte is return value. */ -static const char tbl_verb[] = /* 2nd byte matches RTACTION_* code */ +/* 2nd byte matches RTACTION_* code */ +static const char tbl_verb[] ALIGN1 = "\006\001add\0" "\006\002del\0" /* "\011\002delete\0" */ - "\010\002delete" /* Since last, we can save a byte. */ + "\010\002delete" /* Since it's last, we can save a byte. */ ; int route_main(int argc, char **argv); diff --git a/networking/slattach.c b/networking/slattach.c index 4bac879..f78c88e 100644 --- a/networking/slattach.c +++ b/networking/slattach.c @@ -123,7 +123,7 @@ int slattach_main(int argc, char **argv); int slattach_main(int argc, char **argv) { /* Line discipline code table */ - static const char proto_names[] = + static const char proto_names[] ALIGN1 = "slip\0" /* 0 */ "cslip\0" /* 1 */ "slip6\0" /* 2 */ diff --git a/networking/telnet.c b/networking/telnet.c index a634d7a..4e8b27b 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -353,7 +353,7 @@ static void putiac_naws(byte c, int x, int y) } #endif -static char const escapecharis[] = "\r\nEscape character is "; +static char const escapecharis[] ALIGN1 = "\r\nEscape character is "; static void setConMode(void) { diff --git a/networking/tftp.c b/networking/tftp.c index b20486c..85d1a85 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -278,7 +278,7 @@ static int tftp( USE_GETPUT(const int cmd,) "unknown transfer id", "file already exists", "no such user", - "bad option", + "bad option" }; const char *msg = ""; @@ -309,7 +309,7 @@ static int tftp( USE_GETPUT(const int cmd,) /* htons can be impossible to use in const initializer: */ /*static const uint16_t error_8[2] = { htons(TFTP_ERROR), htons(8) };*/ /* thus we open-code big-endian layout */ - static const char error_8[4] = { 0,TFTP_ERROR, 0,8 }; + static const uint8_t error_8[4] = { 0,TFTP_ERROR, 0,8 }; xsendto(socketfd, error_8, 4, &peer_lsa->sa, peer_lsa->len); bb_error_msg("server proposes bad blksize %d, exiting", blksize); goto ret; diff --git a/networking/traceroute.c b/networking/traceroute.c index c87f7ff..20f304d 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -700,7 +700,7 @@ send_probe(int seq, int ttl) static inline const char * pr_type(unsigned char t) { - static const char * const ttab[] = { + static const char *const ttab[] = { "Echo Reply", "ICMP 1", "ICMP 2", "Dest Unreachable", "Source Quench", "Redirect", "ICMP 6", "ICMP 7", "Echo", "Router Advert", "Router Solicit", "Time Exceeded", diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c index 59c0155..a47bbaf 100644 --- a/networking/udhcp/common.c +++ b/networking/udhcp/common.c @@ -6,4 +6,6 @@ #include "common.h" -const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +const uint8_t MAC_BCAST_ADDR[6] ALIGN2 = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index efe2088..0e89c3c 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -180,7 +180,7 @@ int udhcpc_main(int argc, char **argv) OPT_v = 1 << 17, }; #if ENABLE_GETOPT_LONG - static const char udhcpc_longopts[] = + static const char udhcpc_longopts[] ALIGN1 = "clientid\0" Required_argument "c" "clientid-none\0" No_argument "C" "vendorclass\0" Required_argument "V" diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index f9f9231..a0765be 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c @@ -24,7 +24,7 @@ int dumpleases_main(int argc, char **argv) OPT_f = 0x4, // -f }; #if ENABLE_GETOPT_LONG - static const char dumpleases_longopts[] = + static const char dumpleases_longopts[] ALIGN1 = "absolute\0" No_argument "a" "remaining\0" No_argument "r" "file\0" Required_argument "f" diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index a58adb9..3168fc6 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c @@ -52,7 +52,7 @@ const struct dhcp_option dhcp_options[] = { }; /* Lengths of the different option types */ -const unsigned char option_lengths[] = { +const unsigned char option_lengths[] ALIGN1 = { [OPTION_IP] = 4, [OPTION_IP_PAIR] = 8, [OPTION_BOOLEAN] = 1, diff --git a/networking/vconfig.c b/networking/vconfig.c index 4776e13..8bd8870 100644 --- a/networking/vconfig.c +++ b/networking/vconfig.c @@ -63,7 +63,7 @@ static const char *xfind_str(const char *table, const char *str) return table - 1; } -static const char cmds[] = { +static const char cmds[] ALIGN1 = { 4, ADD_VLAN_CMD, 7, 'a', 'd', 'd', 0, 3, DEL_VLAN_CMD, 7, @@ -85,7 +85,7 @@ static const char cmds[] = { 'm', 'a', 'p', 0, }; -static const char name_types[] = { +static const char name_types[] ALIGN1 = { VLAN_NAME_TYPE_PLUS_VID, 16, 'V', 'L', 'A', 'N', '_', 'P', 'L', 'U', 'S', '_', 'V', 'I', 'D', @@ -104,7 +104,7 @@ static const char name_types[] = { '_', 'N', 'O', '_', 'P', 'A', 'D', 0, }; -static const char conf_file_name[] = "/proc/net/vlan/config"; +static const char conf_file_name[] ALIGN1 = "/proc/net/vlan/config"; int vconfig_main(int argc, char **argv); int vconfig_main(int argc, char **argv) diff --git a/networking/wget.c b/networking/wget.c index 7b583c7..d90368c 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -114,7 +114,7 @@ int wget_main(int argc, char **argv) bool use_proxy = 1; /* Use proxies if env vars are set */ const char *proxy_flag = "on"; /* Use proxies if env vars are set */ const char *user_agent = "Wget";/* "User-Agent" header field */ - static const char keywords[] = + static const char keywords[] ALIGN1 = "content-length\0""transfer-encoding\0""chunked\0""location\0"; enum { KEY_content_length = 1, KEY_transfer_encoding, KEY_chunked, KEY_location @@ -131,7 +131,7 @@ int wget_main(int argc, char **argv) WGET_OPT_HEADER = 0x100, }; #if ENABLE_FEATURE_WGET_LONG_OPTIONS - static const char wget_longopts[] = + static const char wget_longopts[] ALIGN1 = /* name, has_arg, val */ "continue\0" No_argument "c" "spider\0" No_argument "s" @@ -539,7 +539,7 @@ static void parse_url(char *src_url, struct host_info *h) p = strchr(h->host, '#'); if (!sp || (p && sp > p)) sp = p; if (!sp) { /* must be writable because of bb_get_last_path_component() */ - static char nullstr[] = ""; + static char nullstr[] ALIGN1 = ""; h->path = nullstr; } else if (*sp == '/') { *sp = '\0'; diff --git a/procps/nmeter.c b/procps/nmeter.c index 4f78a14..127a3d1 100644 --- a/procps/nmeter.c +++ b/procps/nmeter.c @@ -36,7 +36,7 @@ static const char *const proc_name[] = { "net/dev", "meminfo", "diskstats", - "sys/fs/file-nr", + "sys/fs/file-nr" }; struct globals { @@ -754,7 +754,7 @@ static void collect_info(s_stat *s) typedef s_stat* init_func(const char *param); -static const char options[] = "ncmsfixptbdr"; +static const char options[] ALIGN1 = "ncmsfixptbdr"; static init_func *const init_functions[] = { init_if, init_cpu, @@ -767,7 +767,7 @@ static init_func *const init_functions[] = { init_time, init_blk, init_delay, - init_cr, + init_cr }; int nmeter_main(int argc, char **argv); diff --git a/procps/renice.c b/procps/renice.c index 6c5bb0e..b2a9ed7 100644 --- a/procps/renice.c +++ b/procps/renice.c @@ -29,7 +29,7 @@ void BUG_bad_PRIO_USER(void); int renice_main(int argc, char **argv); int renice_main(int argc, char **argv) { - static const char Xetpriority_msg[] = "%cetpriority"; + static const char Xetpriority_msg[] ALIGN1 = "%cetpriority"; int retval = EXIT_SUCCESS; int which = PRIO_PROCESS; /* Default 'which' value. */ @@ -67,8 +67,9 @@ int renice_main(int argc, char **argv) while ((arg = *++argv) != NULL) { /* Check for a mode switch. */ if (arg[0] == '-' && arg[1]) { - static const char opts[] - = { 'p', 'g', 'u', 0, PRIO_PROCESS, PRIO_PGRP, PRIO_USER }; + static const char opts[] ALIGN1 = { + 'p', 'g', 'u', 0, PRIO_PROCESS, PRIO_PGRP, PRIO_USER + }; const char *p = strchr(opts, arg[1]); if (p) { which = p[4]; diff --git a/procps/sysctl.c b/procps/sysctl.c index a0e9e16..5100f57 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c @@ -27,24 +27,27 @@ static int sysctl_display_all(const char *path, int output, int show_table); /* * Globals... */ -static const char PROC_PATH[] = "/proc/sys/"; -static const char DEFAULT_PRELOAD[] = "/etc/sysctl.conf"; +static const char PROC_PATH[] ALIGN1 = "/proc/sys/"; +static const char DEFAULT_PRELOAD[] ALIGN1 = "/etc/sysctl.conf"; /* error messages */ -static const char ERR_UNKNOWN_PARAMETER[] = "error: Unknown parameter '%s'\n"; -static const char ERR_MALFORMED_SETTING[] = "error: Malformed setting '%s'\n"; -static const char ERR_NO_EQUALS[] = +static const char ERR_UNKNOWN_PARAMETER[] ALIGN1 = + "error: Unknown parameter '%s'\n"; +static const char ERR_MALFORMED_SETTING[] ALIGN1 = + "error: Malformed setting '%s'\n"; +static const char ERR_NO_EQUALS[] ALIGN1 = "error: '%s' must be of the form name=value\n"; -static const char ERR_INVALID_KEY[] = "error: '%s' is an unknown key\n"; -static const char ERR_UNKNOWN_WRITING[] = +static const char ERR_INVALID_KEY[] ALIGN1 = + "error: '%s' is an unknown key\n"; +static const char ERR_UNKNOWN_WRITING[] ALIGN1 = "error: unknown error %d setting key '%s'\n"; -static const char ERR_UNKNOWN_READING[] = +static const char ERR_UNKNOWN_READING[] ALIGN1 = "error: unknown error %d reading key '%s'\n"; -static const char ERR_PERMISSION_DENIED[] = +static const char ERR_PERMISSION_DENIED[] ALIGN1 = "error: permission denied on key '%s'\n"; -static const char ERR_PRELOAD_FILE[] = +static const char ERR_PRELOAD_FILE[] ALIGN1 = "error: cannot open preload file '%s'\n"; -static const char WARN_BAD_LINE[] = +static const char WARN_BAD_LINE[] ALIGN1 = "warning: %s(%d): invalid syntax, continuing...\n"; diff --git a/scripts/mkconfigs b/scripts/mkconfigs index d212ad4..0d1771a 100755 --- a/scripts/mkconfigs +++ b/scripts/mkconfigs @@ -44,7 +44,7 @@ echo "\ * Do not edit. * */ -static const char * const bbconfig_config =" +static const char *const bbconfig_config =" sed 's/\"/\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\"" $0 "\\n\"";}' diff --git a/scripts/trylink b/scripts/trylink index 74acb4c..9b67deb 100755 --- a/scripts/trylink +++ b/scripts/trylink @@ -6,7 +6,7 @@ try() { added="$1" shift $debug && echo "Trying: $* $added" - "$@" $added >busybox.map 2>busybox_ld.err + "$@" $added 2>busybox_ld.err } # Sanitize lib list (dups, extra spaces etc) @@ -22,14 +22,17 @@ try "-Wl,--start-group $l_list -Wl,--end-group" "$@" \ cat busybox_ld.err exit 1 } -# Hack: we are not supposed to know executable name, -# but this hack cuts down link time -mv busybox_unstripped busybox_unstripped.tmp -mv busybox.map busybox.map.tmp + +#### Hack disabled: conflicts with ld --verbose flag in last link phase + +##### Hack: we are not supposed to know executable name, +##### but this hack cuts down link time +####mv busybox_unstripped busybox_unstripped.tmp +####mv busybox.map busybox.map.tmp # Now try to remove each lib and build without it. # Stop when no lib can be removed. -ever_discarded=false +####ever_discarded=false while test "$BBOX_LIB_LIST"; do $debug && echo "Trying libraries: $BBOX_LIB_LIST" all_needed=true @@ -41,7 +44,7 @@ while test "$BBOX_LIB_LIST"; do echo "Library $one is not needed" BBOX_LIB_LIST="$without_one" all_needed=false - ever_discarded=true +#### ever_discarded=true else echo "Library $one is needed" fi @@ -54,13 +57,23 @@ while test "$BBOX_LIB_LIST"; do #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break done -mv busybox_unstripped.tmp busybox_unstripped -mv busybox.map.tmp busybox.map -$ever_discarded && { +####mv busybox_unstripped.tmp busybox_unstripped +####mv busybox.map.tmp busybox.map +####$ever_discarded && { # Make the binary with final, minimal list of libs echo "Final link with: $BBOX_LIB_LIST" l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'` - try "-Wl,--start-group $l_list -Wl,--end-group" "$@" || exit 1 -} -rm busybox_ld.err -exit 0 # Ensure "success" exit code + # --verbose gives us gobs of info to stdout (e.g. linker script used) + try "-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose" "$@" >busybox_ld.out ####|| exit 1 + # + # Add SORT_BY_ALIGNMENT to linker script (found in busybox_ld.out): + # .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) } + # *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*) + # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*) + # This will eliminate most of the data padding. Use linker script + # by commenting "try" above and uncommenting this one (tested on i386): + #try "-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose -Wl,-T -Wl,busybox_ldscript" "$@" >busybox_ld.out + # +####} +####rm busybox_ld.err +####exit 0 # Ensure "success" exit code diff --git a/selinux/chcon.c b/selinux/chcon.c index 6e98c4a..a955228 100644 --- a/selinux/chcon.c +++ b/selinux/chcon.c @@ -105,7 +105,7 @@ skip: } #if ENABLE_FEATURE_CHCON_LONG_OPTIONS -static const char chcon_longopts[] = +static const char chcon_longopts[] ALIGN1 = "recursive\0" No_argument "R" "changes\0" No_argument "c" "no-dereference\0" No_argument "h" diff --git a/selinux/runcon.c b/selinux/runcon.c index 5f9e3fd..6c3f518 100644 --- a/selinux/runcon.c +++ b/selinux/runcon.c @@ -69,7 +69,7 @@ static context_t runcon_compute_new_context(char *user, char *role, char *type, } #if ENABLE_FEATURE_RUNCON_LONG_OPTIONS -static const char runcon_options[] = +static const char runcon_longopts[] ALIGN1 = "user\0" Required_argument "u" "role\0" Required_argument "r" "type\0" Required_argument "t" @@ -101,7 +101,7 @@ int runcon_main(int argc, char **argv) selinux_or_die(); #if ENABLE_FEATURE_RUNCON_LONG_OPTIONS - applet_long_options = runcon_options; + applet_long_options = runcon_longopts; #endif opt_complementary = "-1"; opts = getopt32(argc, argv, "r:t:u:l:ch", &role, &type, &user, &range); diff --git a/selinux/setfiles.c b/selinux/setfiles.c index df77d60..dcc8cbb 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c @@ -409,7 +409,7 @@ static int apply_spec(const char *file, static int canoncon(const char *path, unsigned lineno, char **contextp) { - static const char err_msg[] = "%s: line %u has invalid context %s"; + static const char err_msg[] ALIGN1 = "%s: line %u has invalid context %s"; char *tmpcon; char *context = *contextp; diff --git a/shell/ash.c b/shell/ash.c index d34f520..9aec8ee 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -91,10 +91,10 @@ static const char *const optletters_optnames[] = { "a" "allexport", "b" "notify", "u" "nounset", - "\0" "vi", + "\0" "vi" #if DEBUG - "\0" "nolog", - "\0" "debug", + ,"\0" "nolog" + ,"\0" "debug" #endif }; @@ -103,7 +103,7 @@ static const char *const optletters_optnames[] = { enum { NOPTS = ARRAY_SIZE(optletters_optnames) }; -static char optlist[NOPTS]; +static char optlist[NOPTS] ALIGN1; #define eflag optlist[0] #define fflag optlist[1] @@ -127,12 +127,12 @@ static char optlist[NOPTS]; /* ============ Misc data */ -static char nullstr[1]; /* zero length string */ -static const char homestr[] = "HOME"; -static const char snlfmt[] = "%s\n"; -static const char illnum[] = "Illegal number: %s"; +static char nullstr[1] ALIGN1; /* zero length string */ +static const char homestr[] ALIGN1 = "HOME"; +static const char snlfmt[] ALIGN1 = "%s\n"; +static const char illnum[] ALIGN1 = "Illegal number: %s"; -static char *minusc; /* argument to -c option */ +static char *minusc; /* argument to -c option */ /* pid of main shell */ static int rootpid; @@ -447,7 +447,9 @@ out2str(const char *p) #define VSTRIMLEFTMAX 0x9 /* ${var##pattern} */ #define VSLENGTH 0xa /* ${#var} */ -static const char dolatstr[] = { CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' }; +static const char dolatstr[] ALIGN1 = { + CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' +}; #define NCMD 0 #define NPIPE 1 @@ -1583,10 +1585,10 @@ static unsigned long rseed; #endif #ifdef IFS_BROKEN -static const char defifsvar[] = "IFS= \t\n"; +static const char defifsvar[] ALIGN1 = "IFS= \t\n"; #define defifs (defifsvar + 4) #else -static const char defifs[] = " \t\n"; +static const char defifs[] ALIGN1 = " \t\n"; #endif struct shparam { @@ -2548,16 +2550,16 @@ static const char S_I_T[][3] = { static int SIT(int c, int syntax) { - static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; + static const char spec_symbls[] ALIGN1 = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; #if ENABLE_ASH_ALIAS - static const char syntax_index_table[] = { + static const char syntax_index_table[] ALIGN1 = { 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */ 11, 3 /* "}~" */ }; #else - static const char syntax_index_table[] = { + static const char syntax_index_table[] ALIGN1 = { 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */ 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */ 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */ @@ -5003,7 +5005,7 @@ esclen(const char *start, const char *p) static char * _rmescapes(char *str, int flag) { - static const char qchars[] = { CTLESC, CTLQUOTEMARK, '\0' }; + static const char qchars[] ALIGN1 = { CTLESC, CTLQUOTEMARK, '\0' }; char *p, *q, *r; unsigned inquotes; @@ -5420,7 +5422,7 @@ static char *evalvar(char *p, int flag); static void argstr(char *p, int flag) { - static const char spclchars[] = { + static const char spclchars[] ALIGN1 = { '=', ':', CTLQUOTEMARK, @@ -6266,7 +6268,7 @@ expsort(struct strlist *str) static void expandmeta(struct strlist *str, int flag) { - static const char metachars[] = { + static const char metachars[] ALIGN1 = { '*', '?', '[', 0 }; /* TODO - EXP_REDIR */ @@ -10200,7 +10202,7 @@ parsesub: { int typeloc; int flags; char *p; - static const char types[] = "}-+?="; + static const char types[] ALIGN1 = "}-+?="; c = pgetc(); if ( @@ -10496,13 +10498,15 @@ parsearith: { #define NEW_xxreadtoken #ifdef NEW_xxreadtoken /* singles must be first! */ -static const char xxreadtoken_chars[7] = { '\n', '(', ')', '&', '|', ';', 0 }; +static const char xxreadtoken_chars[7] ALIGN1 = { + '\n', '(', ')', '&', '|', ';', 0 +}; -static const char xxreadtoken_tokens[] = { +static const char xxreadtoken_tokens[] ALIGN1 = { TNL, TLP, TRP, /* only single occurrence allowed */ TBACKGND, TPIPE, TSEMI, /* if single occurrence */ TEOF, /* corresponds to trailing nul */ - TAND, TOR, TENDCASE, /* if double occurrence */ + TAND, TOR, TENDCASE /* if double occurrence */ }; #define xxreadtoken_doubles \ @@ -11379,7 +11383,7 @@ unsetcmd(int argc, char **argv) #include <sys/times.h> -static const unsigned char timescmd_str[] = { +static const unsigned char timescmd_str[] ALIGN1 = { ' ', offsetof(struct tms, tms_utime), '\n', offsetof(struct tms, tms_stime), ' ', offsetof(struct tms, tms_cutime), @@ -11659,9 +11663,9 @@ readcmd(int argc, char **argv) static int umaskcmd(int argc, char **argv) { - static const char permuser[3] = "ugo"; - static const char permmode[3] = "rwx"; - static const short int permmask[] = { + static const char permuser[3] ALIGN1 = "ugo"; + static const char permmode[3] ALIGN1 = "rwx"; + static const short permmask[] ALIGN2 = { S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH @@ -12318,7 +12322,7 @@ arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) } /* longest must be first */ -static const char op_tokens[] = { +static const char op_tokens[] ALIGN1 = { '<','<','=',0, TOK_LSHIFT_ASSIGN, '>','>','=',0, TOK_RSHIFT_ASSIGN, '<','<', 0, TOK_LSHIFT, diff --git a/shell/hush.c b/shell/hush.c index 275b69e..5796f11 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -126,7 +126,8 @@ extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */ /* broken, of course, but OK for testing */ static const char *indenter(int i) { - static const char blanks[] = " "; + static const char blanks[] ALIGN1 = + " "; return &blanks[sizeof(blanks) - i - 1]; } #define debug_printf_clean(...) fprintf(stderr, __VA_ARGS__) @@ -3656,7 +3657,7 @@ static void setup_job_control(void) int hush_main(int argc, char **argv); int hush_main(int argc, char **argv) { - static const char version_str[] = "HUSH_VERSION="HUSH_VER_STR; + static const char version_str[] ALIGN1 = "HUSH_VERSION="HUSH_VER_STR; static const struct variable const_shell_ver = { .next = NULL, .varstr = (char*)version_str, diff --git a/shell/lash.c b/shell/lash.c index e5c7ef6..c28a103 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -711,7 +711,7 @@ static char * strsep_space(char *string, int * ix) static int expand_arguments(char *command) { - static const char out_of_space[] = "out of space during expansion"; + static const char out_of_space[] ALIGN1 = "out of space during expansion"; int total_length = 0, length, i, retval, ix = 0; expand_t expand_result; diff --git a/shell/msh.c b/shell/msh.c index effdc01..f1b3f05 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -280,7 +280,7 @@ struct brkcon { * -x: trace * -u: unset variables net diagnostic */ -static char flags['z' - 'a' + 1]; +static char flags['z' - 'a' + 1] ALIGN1; /* this looks weird, but is OK ... we index FLAG with 'a'...'z' */ #define FLAG (flags - 'a') @@ -577,7 +577,7 @@ struct here { struct here *h_next; }; -static const char * const signame[] = { +static const char *const signame[] = { "Signal 0", "Hangup", NULL, /* interrupt */ @@ -593,11 +593,10 @@ static const char * const signame[] = { "SIGUSR2", NULL, /* broken pipe */ "Alarm clock", - "Terminated", + "Terminated" }; - struct res { const char *r_name; int r_val; @@ -4209,7 +4208,7 @@ static char *unquote(char *as) #define NDENT ((BLKSIZ+sizeof(struct dirent)-1)/sizeof(struct dirent)) static struct wdblock *cl, *nl; -static char spcl[] = "[?*"; +static const char spcl[] ALIGN1= "[?*"; static struct wdblock *glob(char *cp, struct wdblock *wb) { diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 0a8dbe9..2933db4 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -48,12 +48,12 @@ struct hd_geometry { #define HDIO_GETGEO 0x0301 /* get device geometry */ -static const char msg_building_new_label[] = +static const char msg_building_new_label[] ALIGN1 = "Building a new %s. Changes will remain in memory only,\n" "until you decide to write them. After that the previous content\n" "won't be recoverable.\n\n"; -static const char msg_part_already_defined[] = +static const char msg_part_already_defined[] ALIGN1 = "Partition %d is already defined, delete it before re-adding\n"; @@ -82,11 +82,11 @@ struct partition { unsigned char size4[4]; /* nr of sectors in partition */ } ATTRIBUTE_PACKED; -static const char unable_to_open[] = "cannot open %s"; -static const char unable_to_read[] = "cannot read from %s"; -static const char unable_to_seek[] = "cannot seek on %s"; -static const char unable_to_write[] = "cannot write to %s"; -static const char ioctl_error[] = "BLKGETSIZE ioctl failed on %s"; +static const char unable_to_open[] ALIGN1 = "cannot open %s"; +static const char unable_to_read[] ALIGN1 = "cannot read from %s"; +static const char unable_to_seek[] ALIGN1 = "cannot seek on %s"; +static const char unable_to_write[] ALIGN1 = "cannot write to %s"; +static const char ioctl_error[] ALIGN1 = "BLKGETSIZE ioctl failed on %s"; static void fdisk_fatal(const char *why) ATTRIBUTE_NORETURN; enum label_type { diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c index 9f0dc7f..f6486d5 100644 --- a/util-linux/fdisk_osf.c +++ b/util-linux/fdisk_osf.c @@ -149,7 +149,7 @@ struct xbsd_disklabel { #define BSD_DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */ #define BSD_DSTYPE_GEOMETRY 0x10 /* drive params in label */ -static const char * const xbsd_dktypenames[] = { +static const char *const xbsd_dktypenames[] = { "unknown", "SMD", "MSCP", diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 41299d2..2460170 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -266,7 +266,7 @@ static void set_shell(const char *new_shell) */ #if ENABLE_GETOPT_LONG -static const char getopt_longopts[] = +static const char getopt_longopts[] ALIGN1 = "options\0" Required_argument "o" "longoptions\0" Required_argument "l" "quiet\0" No_argument "q" diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 213f607..e294f19 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -35,7 +35,7 @@ static void bb_dump_addfile(char *name) fclose(fp); } -static const char * const add_strings[] = { +static const char *const add_strings[] = { "\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"", /* b */ "\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"", /* c */ "\"%07.7_ax \" 8/2 \" %05u \" \"\\n\"", /* d */ @@ -43,9 +43,9 @@ static const char * const add_strings[] = { "\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"", /* x */ }; -static const char add_first[] = "\"%07.7_Ax\n\""; +static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\""; -static const char hexdump_opts[] = "bcdoxCe:f:n:s:v"; +static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v"; static const struct suffix_mult suffixes[] = { { "b", 512 }, diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index ede95ec..8677214 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c @@ -178,7 +178,7 @@ int hwclock_main(int argc, char **argv) int utc; #if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS - static const char hwclock_longopts[] = + static const char hwclock_longopts[] ALIGN1 = "localtime\0" No_argument "l" "utc\0" No_argument "u" "show\0" No_argument "r" diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 17e5e88..33dc5d3 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -233,7 +233,7 @@ static int dirAction(const char *fileName, struct stat *statbuf, * - userspace writes "0" (worked) or "-1" (failed) to /sys/$DEVPATH/loading * - kernel loads firmware into device */ -static inline void load_firmware(const char * const firmware, const char * const sysfs_path) +static void load_firmware(const char *const firmware, const char *const sysfs_path) { int cnt; int firmware_fd, loading_fd, data_fd; diff --git a/util-linux/mount.c b/util-linux/mount.c index a7b0a98..c159f41 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -888,7 +888,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { char *opteq = strchr(opt, '='); if (opteq) { - static const char options[] = + static const char options[] ALIGN1 = /* 0 */ "rsize\0" /* 1 */ "wsize\0" /* 2 */ "timeo\0" @@ -991,7 +991,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) } } else { - static const char options[] = + static const char options[] ALIGN1 = "bg\0" "fg\0" "soft\0" @@ -1524,7 +1524,7 @@ static int singlemount(struct mntent *mp, int ignore_busy) // Parse options, if necessary parse fstab/mtab, and call singlemount for // each directory to be mounted. -static const char must_be_root[] = "you must be root"; +static const char must_be_root[] ALIGN1 = "you must be root"; int mount_main(int argc, char **argv); int mount_main(int argc, char **argv) diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 02afedc..347621c 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -38,8 +38,8 @@ #define S_LEN 128 /* These are the defaults */ -static const char defaultmap[] = "/boot/System.map"; -static const char defaultpro[] = "/proc/profile"; +static const char defaultmap[] ALIGN1 = "/boot/System.map"; +static const char defaultpro[] ALIGN1 = "/proc/profile"; int readprofile_main(int argc, char **argv); int readprofile_main(int argc, char **argv) |