* [PATCH RFA] mi/mi-main.c: Don't use variable-length array extension
@ 2001-07-08 23:28 Kevin Buettner
2001-07-09 7:21 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2001-07-08 23:28 UTC (permalink / raw)
To: gdb-patches
These are probably obvious fixes, but I used alloca() which is
sometimes considered objectionable, so I decided to ask for approval.
I'm willing to rework the patch to use xmalloc(), make_cleanup(), etc,
but it will be messier.
* mi-main.c (register_changed_p, get_register): Use alloca()
to allocate space previously allocated via gcc's
variable-length array extension.
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.19
diff -u -p -r1.19 mi-main.c
--- mi-main.c 2001/06/25 21:05:11 1.19
+++ mi-main.c 2001/07/09 06:17:35
@@ -378,7 +378,7 @@ mi_cmd_data_list_changed_registers (char
static int
register_changed_p (int regnum)
{
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
+ char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
if (read_relative_register_raw_bytes (regnum, raw_buffer))
return -1;
@@ -483,8 +483,8 @@ mi_cmd_data_list_register_values (char *
static int
get_register (int regnum, int format)
{
- char raw_buffer[MAX_REGISTER_RAW_SIZE];
- char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
+ char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+ char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
int optim;
static struct ui_stream *stb = NULL;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFA] mi/mi-main.c: Don't use variable-length array extension
2001-07-08 23:28 [PATCH RFA] mi/mi-main.c: Don't use variable-length array extension Kevin Buettner
@ 2001-07-09 7:21 ` Andrew Cagney
2001-07-09 9:56 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2001-07-09 7:21 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> These are probably obvious fixes, but I used alloca() which is
> sometimes considered objectionable, so I decided to ask for approval.
> I'm willing to rework the patch to use xmalloc(), make_cleanup(), etc,
> but it will be messier.
>
> * mi-main.c (register_changed_p, get_register): Use alloca()
> to allocate space previously allocated via gcc's
> variable-length array extension.
This is one of the uses of alloca that everyone has grown accustomed to.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFA] mi/mi-main.c: Don't use variable-length array extension
2001-07-09 7:21 ` Andrew Cagney
@ 2001-07-09 9:56 ` Kevin Buettner
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Buettner @ 2001-07-09 9:56 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Jul 9, 10:21am, Andrew Cagney wrote:
> > These are probably obvious fixes, but I used alloca() which is
> > sometimes considered objectionable, so I decided to ask for approval.
> > I'm willing to rework the patch to use xmalloc(), make_cleanup(), etc,
> > but it will be messier.
> >
> > * mi-main.c (register_changed_p, get_register): Use alloca()
> > to allocate space previously allocated via gcc's
> > variable-length array extension.
>
>
> This is one of the uses of alloca that everyone has grown accustomed to.
I'll take that as approval then...
Committed.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-07-09 9:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-08 23:28 [PATCH RFA] mi/mi-main.c: Don't use variable-length array extension Kevin Buettner
2001-07-09 7:21 ` Andrew Cagney
2001-07-09 9:56 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox