This is the mail archive of the
archer-commits@sourceware.org
mailing list for the Archer project.
[SCM] archer-keiths-expr-cumulative: * c-exp.y (operator): Assume that the constructed name is already canonicalized. (operator_stoken): s/xmalloc/malloc/g. Add a cleanup to free memory.
- From: kseitz at sourceware dot org
- To: archer-commits at sourceware dot org
- Date: 11 Nov 2009 00:31:00 -0000
- Subject: [SCM] archer-keiths-expr-cumulative: * c-exp.y (operator): Assume that the constructed name is already canonicalized. (operator_stoken): s/xmalloc/malloc/g. Add a cleanup to free memory.
The branch, archer-keiths-expr-cumulative has been updated
via cb92bf334f04ace153a2b8b71e293f79e275248a (commit)
from 7de45a8852e8f4c9f2f29f9c7464314b13dec65a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit cb92bf334f04ace153a2b8b71e293f79e275248a
Author: keiths <keiths@redhat.com>
Date: Tue Nov 10 16:28:17 2009 -0800
* c-exp.y (operator): Assume that the constructed name is already
canonicalized.
(operator_stoken): s/xmalloc/malloc/g. Add a cleanup to free
memory.
-----------------------------------------------------------------------
Summary of changes:
gdb/c-exp.y | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
First 500 lines of diff:
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 3511b8f..a35fa20 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1286,18 +1286,12 @@ operator: OPERATOR NEW
| OPERATOR '[' ']'
{ $$ = operator_stoken ("[]"); }
| OPERATOR ptype
- { char *name, *canon;
+ { char *name;
long length;
struct ui_file *buf = mem_fileopen ();
c_print_type ($2, NULL, buf, -1, 0);
name = ui_file_xstrdup (buf, &length);
- canon = cp_canonicalize_string (name);
- if (canon != NULL)
- {
- xfree (name);
- name = canon;
- }
ui_file_delete (buf);
$$ = operator_stoken (name);
}
@@ -1326,16 +1320,19 @@ name_not_typename : NAME
%%
/* Returns a stoken of the operator name given by OP (which does not
- include the string "operator"). The result is xmalloc'd. */
+ include the string "operator"). The result is malloc'd. */
static struct stoken
operator_stoken (const char *op)
{
static const char *operator_string = "operator";
struct stoken st = { NULL, 0 };
st.length = strlen (operator_string) + strlen (op);
- st.ptr = xmalloc (st.length + 1);
+ st.ptr = malloc (st.length + 1);
strcpy (st.ptr, operator_string);
strcat (st.ptr, op);
+
+ /* The toplevel (c_parse) will free the memory allocated here. */
+ make_cleanup (free, st.ptr);
return st;
};
hooks/post-receive
--
Repository for Project Archer.