This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A couple of uses of xmalloc and xfree in a couple of .y files


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]