aboutsummaryrefslogtreecommitdiff
path: root/gdb/macroexp.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-02-06 01:02:00 +0100
committerTom Tromey <tom@tromey.com>2018-02-08 11:46:55 -0700
commitf6c2623eb8ac7296b6d7a76657394272a71f5aee (patch)
tree7a83749c7e88dc681929f784c2896dc369aa2d1a /gdb/macroexp.h
parent8ce47547b34fddec16d1ccd801f025a56976af95 (diff)
downloadgdb-f6c2623eb8ac7296b6d7a76657394272a71f5aee.zip
gdb-f6c2623eb8ac7296b6d7a76657394272a71f5aee.tar.gz
gdb-f6c2623eb8ac7296b6d7a76657394272a71f5aee.tar.bz2
Return unique_xmalloc_ptr from macro scope functions
This changes the macro scope functions (sal_macro_scope, user_macro_scope, and default_macro_scope) to return a unique_xmalloc_ptr, then fixes up the users. This allowed for the removal of several cleanups. 2018-02-08 Tom Tromey <tom@tromey.com> * symtab.c (default_collect_symbol_completion_matches_break_on): Use unique_xmalloc_ptr. * macroscope.h: (sal_macro_scope, user_macro_scope) (default_macro_scope): Return unique_xmalloc_ptr. * macroscope.c (sal_macro_scope, user_macro_scope) (default_macro_scope): Return unique_xmalloc_ptr. * macroexp.h (macro_expand, macro_expand_once): Return unique_xmalloc_ptr. * macroexp.c (macro_expand, macro_expand_once): Return unique_xmalloc_ptr. * macrocmd.c (macro_expand_command, macro_expand_once_command) (info_macro_command, info_macros_command): Use unique_xmalloc_ptr. * compile/compile-c-support.c (write_macro_definitions): Use unique_xmalloc_ptr. * c-exp.y (c_parse): Use unique_xmalloc_ptr.
Diffstat (limited to 'gdb/macroexp.h')
-rw-r--r--gdb/macroexp.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/macroexp.h b/gdb/macroexp.h
index f7c7411..8d3e3f0 100644
--- a/gdb/macroexp.h
+++ b/gdb/macroexp.h
@@ -37,9 +37,9 @@ typedef struct macro_definition *(macro_lookup_ftype) (const char *name,
preprocessor definitions. SOURCE is a null-terminated string. The
result is a null-terminated string, allocated using xmalloc; it is
the caller's responsibility to free it. */
-char *macro_expand (const char *source,
- macro_lookup_ftype *lookup_func,
- void *lookup_func_baton);
+gdb::unique_xmalloc_ptr<char> macro_expand (const char *source,
+ macro_lookup_ftype *lookup_func,
+ void *lookup_func_baton);
/* Expand all preprocessor macro references that appear explicitly in
@@ -49,9 +49,9 @@ char *macro_expand (const char *source,
SOURCE is a null-terminated string. The result is a
null-terminated string, allocated using xmalloc; it is the caller's
responsibility to free it. */
-char *macro_expand_once (const char *source,
- macro_lookup_ftype *lookup_func,
- void *lookup_func_baton);
+gdb::unique_xmalloc_ptr<char> macro_expand_once (const char *source,
+ macro_lookup_ftype *lookup_func,
+ void *lookup_func_baton);
/* If the null-terminated string pointed to by *LEXPTR begins with a