+2017-03-14 Pedro Alves <palves@redhat.com>
+
+ * cp-name-parser.y (cp_demangled_name_to_comp): Update comment.
+ (main): Use std::unique_ptr. Remove calls to
+ cp_demangled_name_parse_free.
+
2017-03-13 Simon Marchi <simon.marchi@polymtl.ca>
* alpha-bsd-nat.c (alphabsd_fetch_inferior_registers,
}
/* Convert a demangled name to a demangle_component tree. On success,
- a structure containing the root of the new tree is returned; it must
- be freed by calling cp_demangled_name_parse_free. On error, NULL is
- returned, and an error message will be set in *ERRMSG (which does
- not need to be freed). */
+ a structure containing the root of the new tree is returned. On
+ error, NULL is returned, and an error message will be set in
+ *ERRMSG (which does not need to be freed). */
struct std::unique_ptr<demangle_parse_info>
cp_demangled_name_to_comp (const char *demangled_name, const char **errmsg)
char buf[65536];
int arg;
const char *errmsg;
- struct demangle_parse_info *result;
arg = 1;
if (argv[arg] && strcmp (argv[arg], "--debug") == 0)
printf ("%s\n", buf);
continue;
}
- result = cp_demangled_name_to_comp (str2, &errmsg);
+
+ std::unique_ptr<demangle_parse_info> result
+ = cp_demangled_name_to_comp (str2, &errmsg);
if (result == NULL)
{
fputs (errmsg, stderr);
}
cp_print (result->tree);
- cp_demangled_name_parse_free (result);
free (str2);
if (c)
}
else
{
- result = cp_demangled_name_to_comp (argv[arg], &errmsg);
+ std::unique_ptr<demangle_parse_info> result
+ = cp_demangled_name_to_comp (argv[arg], &errmsg);
if (result == NULL)
{
fputs (errmsg, stderr);
return 0;
}
cp_print (result->tree);
- cp_demangled_name_parse_free (result);
putchar ('\n');
}
return 0;