function old new delta
bc_lex_token 1251 1285 +34
bc_POSIX_does_not_allow_bool_ops_this_is_bad - 25 +25
bc_POSIX_does_not_allow_empty_X_expression_in_for - 20 +20
bc_POSIX_does_not_allow - 20 +20
bc_parse_expr 2146 2151 +5
bc_num_ulong 103 92 -11
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/1 up/down: 104/-11) Total: 93 bytes
text data bss dec hex filename
987210 485 7296 994991 f2eaf busybox_old
987084 485 7296 994865 f2e31 busybox_unstripped
^^^^^^^
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
{
return bc_posix_error_fmt("%s", msg);
}
{
return bc_posix_error_fmt("%s", msg);
}
+static int bc_POSIX_does_not_allow(const char *msg)
+{
+ return bc_posix_error_fmt("%s%s", "POSIX does not allow ", msg);
+}
+static int bc_POSIX_does_not_allow_bool_ops_this_is_bad(const char *msg)
+{
+ return bc_posix_error_fmt("%s%s %s", "POSIX does not allow ", "boolean operators; the following is bad:", msg);
+}
+static int bc_POSIX_does_not_allow_empty_X_expression_in_for(const char *msg)
+{
+ return bc_posix_error_fmt("%san empty %s expression in a for loop", "POSIX does not allow ", msg);
+}
static int bc_error_bad_character(char c)
{
return bc_error_fmt("bad character '%c'", c);
static int bc_error_bad_character(char c)
{
return bc_error_fmt("bad character '%c'", c);
match:
// buf starts with keyword bc_lex_kws[i]
l->t.t = BC_LEX_KEY_1st_keyword + i;
match:
// buf starts with keyword bc_lex_kws[i]
l->t.t = BC_LEX_KEY_1st_keyword + i;
- if ((1 << i) & POSIX_KWORD_MASK) {
- s = bc_posix_error("POSIX does not allow the following keyword:"); // bc_lex_kws[i].name8
+ if (!((1 << i) & POSIX_KWORD_MASK)) {
+ s = bc_posix_error_fmt("%sthe following keyword: '%.8s'", "POSIX does not allow ", bc_lex_kws[i].name8);
if (s) return s;
if (l->t.v.len > 2)
if (s) return s;
if (l->t.v.len > 2)
- s = bc_posix_error("POSIX only allows one character names; the following is bad:"); // buf
+ s = bc_posix_error_fmt("POSIX only allows one character names; the following is bad: '%s'", buf);
bc_lex_assign(l, BC_LEX_OP_REL_NE, BC_LEX_OP_BOOL_NOT);
if (l->t.t == BC_LEX_OP_BOOL_NOT) {
bc_lex_assign(l, BC_LEX_OP_REL_NE, BC_LEX_OP_BOOL_NOT);
if (l->t.t == BC_LEX_OP_BOOL_NOT) {
- s = bc_posix_error("POSIX does not allow boolean operators; the following is bad:"); // "!"
+ s = bc_POSIX_does_not_allow_bool_ops_this_is_bad("!");
- s = bc_posix_error("POSIX does not allow '#' script comments");
+ s = bc_POSIX_does_not_allow("'#' script comments");
if (s) return s;
bc_lex_lineComment(l);
if (s) return s;
bc_lex_lineComment(l);
c2 = l->buf[l->i];
if (c2 == '&') {
c2 = l->buf[l->i];
if (c2 == '&') {
- s = bc_posix_error("POSIX does not allow boolean operators; the following is bad:"); // "&&"
+ s = bc_POSIX_does_not_allow_bool_ops_this_is_bad("&&");
s = bc_lex_number(l, c);
else {
l->t.t = BC_LEX_KEY_LAST;
s = bc_lex_number(l, c);
else {
l->t.t = BC_LEX_KEY_LAST;
- s = bc_posix_error("POSIX does not allow a period ('.') as a shortcut for the last result");
+ s = bc_POSIX_does_not_allow("a period ('.') as a shortcut for the last result");
c2 = l->buf[l->i];
if (c2 == '|') {
c2 = l->buf[l->i];
if (c2 == '|') {
- s = bc_posix_error("POSIX does not allow boolean operators; the following is bad:"); // "||"
+ s = bc_POSIX_does_not_allow_bool_ops_this_is_bad("||");
if (p->l.t.t != BC_LEX_SCOLON)
s = bc_parse_expr(p, 0, bc_parse_next_for);
else
if (p->l.t.t != BC_LEX_SCOLON)
s = bc_parse_expr(p, 0, bc_parse_next_for);
else
- s = bc_posix_error("POSIX does not allow an empty init expression in a for loop");
+ s = bc_POSIX_does_not_allow_empty_X_expression_in_for("init");
if (s) return s;
if (p->l.t.t != BC_LEX_SCOLON) return bc_error_bad_token();
if (s) return s;
if (p->l.t.t != BC_LEX_SCOLON) return bc_error_bad_token();
if (p->l.t.t != BC_LEX_SCOLON)
s = bc_parse_expr(p, BC_PARSE_REL, bc_parse_next_for);
else
if (p->l.t.t != BC_LEX_SCOLON)
s = bc_parse_expr(p, BC_PARSE_REL, bc_parse_next_for);
else
- s = bc_posix_error("POSIX does not allow an empty condition expression in a for loop");
+ s = bc_POSIX_does_not_allow_empty_X_expression_in_for("condition");
if (s) return s;
if (p->l.t.t != BC_LEX_SCOLON) return bc_error_bad_token();
if (s) return s;
if (p->l.t.t != BC_LEX_SCOLON) return bc_error_bad_token();
if (p->l.t.t != BC_LEX_RPAREN)
s = bc_parse_expr(p, 0, bc_parse_next_rel);
else
if (p->l.t.t != BC_LEX_RPAREN)
s = bc_parse_expr(p, 0, bc_parse_next_rel);
else
- s = bc_posix_error("POSIX does not allow an empty update expression in a for loop");
+ s = bc_POSIX_does_not_allow_empty_X_expression_in_for("update");
ok:
if (!(flags & BC_PARSE_REL) && nrelops) {
ok:
if (!(flags & BC_PARSE_REL) && nrelops) {
- s = bc_posix_error("POSIX does not allow comparison operators outside if or loops");
+ s = bc_POSIX_does_not_allow("comparison operators outside if or loops");
if (s) return s;
}
else if ((flags & BC_PARSE_REL) && nrelops > 1) {
if (s) return s;
}
else if ((flags & BC_PARSE_REL) && nrelops > 1) {