toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot | got_e | got_p, &yylval);
if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\"."), err_copy);
- }
+ error (_("Invalid number \"%.*s\"."), (int) (p - tokstart),
+ tokstart);
pstate->lexptr = p;
return toktype;
}
case CHAR:
case STRING:
- {
- char *copy = (char *) alloca (value.tsval.length + 1);
-
- memcpy (copy, value.tsval.ptr, value.tsval.length);
- copy[value.tsval.length] = '\0';
-
- parser_fprintf (file, "tsval<type=%d, %s>", value.tsval.type, copy);
- }
+ parser_fprintf (file, "tsval<type=%d, %.*s>", value.tsval.type,
+ value.tsval.length, val.tsval.ptr);
break;
case NSSTRING:
lvalp);
if (toktype == ERROR)
{
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
yyerror (state, _("invalid number"));
return ERROR;
}
static void
first_component_command (const char *arg, int from_tty)
{
- int len;
- char *prefix;
-
if (!arg)
return;
- len = cp_find_first_component (arg);
- prefix = (char *) alloca (len + 1);
-
- memcpy (prefix, arg, len);
- prefix[len] = '\0';
-
- gdb_printf ("%s\n", prefix);
+ int len = cp_find_first_component (arg);
+ gdb_printf ("%.*s\n", len, arg);
}
/* Implement "info vtbl". */
toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot|got_e, &yylval);
if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\"."), err_copy);
- }
+ error (_("Invalid number \"%.*s\"."), (int) (p - tokstart),
+ tokstart);
pstate->lexptr = p;
return toktype;
}
got_dot|got_e|got_d,
&yylval);
if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\"."), err_copy);
- }
+ error (_("Invalid number \"%.*s\"."), (int) (p - tokstart),
+ tokstart);
pstate->lexptr = p;
return toktype;
}
toktype = parse_number (par_state, tokstart, p - tokstart,
got_dot|got_e, &yylval);
if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\"."), err_copy);
- }
+ error (_("Invalid number \"%.*s\"."), (int) (p - tokstart),
+ tokstart);
par_state->lexptr = p;
return toktype;
}
}
toktype = parse_number (p - tokstart);
if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\"."), err_copy);
- }
+ error (_("Invalid number \"%.*s\"."), (int) (p - tokstart),
+ tokstart);
pstate->lexptr = p;
return toktype;
}
toktype = parse_number (pstate, tokstart,
p - tokstart, got_dot | got_e, &yylval);
if (toktype == ERROR)
- {
- char *err_copy = (char *) alloca (p - tokstart + 1);
-
- memcpy (err_copy, tokstart, p - tokstart);
- err_copy[p - tokstart] = 0;
- error (_("Invalid number \"%s\"."), err_copy);
- }
+ error (_("Invalid number \"%.*s\"."), (int) (p - tokstart),
+ tokstart);
pstate->lexptr = p;
return toktype;
}