Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* A couple of uses of xmalloc and xfree in a couple of .y files
@ 2008-10-24 22:58 Pedro Alves
  2008-10-25  0:14 ` Joel Brobecker
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2008-10-24 22:58 UTC (permalink / raw)
  To: gdb-patches

[-- 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);
     }
 }
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-10-27 19:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-24 22:58 A couple of uses of xmalloc and xfree in a couple of .y files Pedro Alves
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox