Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: A couple of uses of xmalloc and xfree in a couple of .y files
Date: Fri, 24 Oct 2008 22:58:00 -0000	[thread overview]
Message-ID: <200810242358.11089.pedro@codesourcery.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

We don't use xmalloc or xrealloc in .y files, as explained at the top of
every .y file.   When I pointed it out to Tom recently, he pointed
out these two left overs.

We don't actually s/free/xfree/, but, there are many other
references to free, and it's just, IMHO best to be consistent, to
prevent confusion; plus, if it made a difference, it should be fixed
in Makefile.in, IMVHO.

Anything I'm missing preventing me from applying this as obvious?

-- 
Pedro Alves

[-- Attachment #2: xfree_xmalloc.diff --]
[-- Type: text/x-diff, Size: 1300 bytes --]

2008-10-24  Pedro Alves  <pedro@codesourcery.com>

	* ada-exp.y (write_object_renaming): Use malloc instead of
	xmalloc.
	* p-exp.y (pop_current_type): Use free instead of xfree.

---
 gdb/ada-exp.y |    2 +-
 gdb/p-exp.y   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: src/gdb/ada-exp.y
===================================================================
--- src.orig/gdb/ada-exp.y	2008-10-24 23:38:53.000000000 +0100
+++ src/gdb/ada-exp.y	2008-10-24 23:39:10.000000000 +0100
@@ -987,7 +987,7 @@ write_object_renaming (struct block *ori
 	  if (end == NULL)
 	    end = renaming_expr + strlen (renaming_expr);
 	  field_name.length = end - renaming_expr;
-	  field_name.ptr = xmalloc (end - renaming_expr + 1);
+	  field_name.ptr = malloc (end - renaming_expr + 1);
 	  strncpy (field_name.ptr, renaming_expr, end - renaming_expr);
 	  field_name.ptr[end - renaming_expr] = '\000';
 	  renaming_expr = end;
Index: src/gdb/p-exp.y
===================================================================
--- src.orig/gdb/p-exp.y	2008-10-24 23:38:32.000000000 +0100
+++ src/gdb/p-exp.y	2008-10-24 23:39:29.000000000 +0100
@@ -1023,7 +1023,7 @@ pop_current_type (void)
     {
       current_type = tp->stored;
       tp_top = tp->next;
-      xfree (tp);
+      free (tp);
     }
 }
 

             reply	other threads:[~2008-10-24 22:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-24 22:58 Pedro Alves [this message]
2008-10-25  0:14 ` Joel Brobecker
2008-10-25  1:58   ` Daniel Jacobowitz
2008-10-25  2:37     ` Pedro Alves
2008-10-25  6:33       ` Daniel Jacobowitz
2008-10-25 15:54       ` Joel Brobecker
2008-10-27 11:48         ` Pedro Alves
2008-10-27 22:38           ` Pedro Alves

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=200810242358.11089.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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