Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH RFA] mi/mi-main.c: Don't use variable-length array extension
Date: Sun, 08 Jul 2001 23:28:00 -0000	[thread overview]
Message-ID: <1010709062833.ZM9934@ocotillo.lan> (raw)

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;
 


             reply	other threads:[~2001-07-08 23:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-08 23:28 Kevin Buettner [this message]
2001-07-09  7:21 ` Andrew Cagney
2001-07-09  9:56   ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010709062833.ZM9934@ocotillo.lan \
    --to=kevinb@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox