aboutsummaryrefslogtreecommitdiff
path: root/gdb/typeprint.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2020-11-23 21:45:35 -0500
committerJoel Brobecker <brobecker@adacore.com>2020-11-23 21:45:35 -0500
commit987b670356322ba4d493f441855bf5dc8d946e9f (patch)
tree50b180ece0ac5d200979b6edefa31fff29cb8adb /gdb/typeprint.c
parent4fbb7ccebe1fdcbae762e8fed6af7a810c81f85c (diff)
downloadfsf-binutils-gdb-987b670356322ba4d493f441855bf5dc8d946e9f.zip
fsf-binutils-gdb-987b670356322ba4d493f441855bf5dc8d946e9f.tar.gz
fsf-binutils-gdb-987b670356322ba4d493f441855bf5dc8d946e9f.tar.bz2
change and rename gmp_string_asprintf to return an std::string
This was suggested by Simon during a code review of this package upstream. The upside is that this makes the function's API more natural and C++. The downside is an extra malloc, which might be the reason why we went for using a unique_xmalloc_ptr in the first place. Since this function is not expected to be called frequently, the API improvement might be worth the performance impact. gdb/ChangeLog: * gmp-utils.h (gmp_string_printf): Rename from gmp_string_asprintf. Change return type to std::string. Update all callers. * gmp-utils.c (gmp_string_printf): Likewise.
Diffstat (limited to 'gdb/typeprint.c')
-rw-r--r--gdb/typeprint.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index f947faf..0dd3b1c 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -667,11 +667,10 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
void
print_type_fixed_point (struct type *type, struct ui_file *stream)
{
- gdb::unique_xmalloc_ptr<char> small_img
- = fixed_point_scaling_factor (type).str ();
+ std::string small_img = fixed_point_scaling_factor (type).str ();
fprintf_filtered (stream, "%s-byte fixed point (small = %s)",
- pulongest (TYPE_LENGTH (type)), small_img.get ());
+ pulongest (TYPE_LENGTH (type)), small_img.c_str ());
}
/* Dump details of a type specified either directly or indirectly.