From 6ca409e0e4c198fe3081346eebbae3f068fe605a Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 12 Aug 2007 20:58:27 +0000 Subject: 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 --- libbb/compare_string_array.c | 4 +-- libbb/dump.c | 10 ++++---- libbb/getopt32.c | 2 +- libbb/human_readable.c | 12 ++++----- libbb/login.c | 4 +-- libbb/md5.c | 4 +-- libbb/messages.c | 54 ++++++++++++++++++++--------------------- libbb/mode_string.c | 4 +-- libbb/mtab_file.c | 2 +- libbb/parse_mode.c | 4 +-- libbb/process_escape_sequence.c | 2 +- libbb/uuencode.c | 4 +-- 12 files changed, 53 insertions(+), 53 deletions(-) (limited to 'libbb') 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 /* 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', -- cgit v1.1