From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1912 invoked by alias); 24 Oct 2008 22:58:53 -0000 Received: (qmail 1901 invoked by uid 22791); 24 Oct 2008 22:58:53 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 24 Oct 2008 22:58:07 +0000 Received: (qmail 18782 invoked from network); 24 Oct 2008 22:58:05 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Oct 2008 22:58:05 -0000 From: Pedro Alves 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 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_DMlAJToDgj6qDUn" Message-Id: <200810242358.11089.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00624.txt.bz2 --Boundary-00=_DMlAJToDgj6qDUn Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 468 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 --Boundary-00=_DMlAJToDgj6qDUn Content-Type: text/x-diff; charset="utf-8"; name="xfree_xmalloc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xfree_xmalloc.diff" Content-length: 1300 2008-10-24 Pedro Alves * 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); } } --Boundary-00=_DMlAJToDgj6qDUn--