diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-13 00:58:27 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-08-13 00:58:27 +0400 |
commit | 6ca409e0e4c198fe3081346eebbae3f068fe605a (patch) | |
tree | 060cb05d99220a1eda399194d1209c269f0e8cd8 /editors | |
parent | 4185548984357df91311f30c8e43d95f33922576 (diff) |
trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts
size saving: 0.5k
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 37 | ||||
-rw-r--r-- | editors/cmp.c | 8 | ||||
-rw-r--r-- | editors/diff.c | 2 | ||||
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 18 |
5 files changed, 33 insertions, 34 deletions
diff --git a/editors/awk.c b/editors/awk.c index 752c73e7e..4ec3d4652 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 da431f39b..ffdfb9103 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 88f8b22db..41808b1ac 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 4647079aa..01ef93c6c 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 c4f3a8393..74566499c 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 |