From db92ac4568f1d4cc1a3409098d033afbe8b555f5 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Sep 2020 08:38:22 -0600 Subject: Use arrays rather than pointers for global string constants My understanding is that it's mildly better to use a static const array, as opposed to a "const char *", for a global string constant, when possible. This makes sense to me because the pointer requires a load from an address, whereas the array is just the address. So, I searched for these in gdb and gdbserver. This patch fixes the ones I found. gdb/ChangeLog 2020-09-15 Tom Tromey * unittests/memory-map-selftests.c (valid_mem_map): Now array. * ui-style.c (ansi_regex_text): Now array. * rust-exp.y (number_regex_text): Now array. * linespec.c (linespec_quote_characters): Now array. * jit.c (jit_break_name, jit_descriptor_name, reader_init_fn_sym): Now arrays. gdbserver/ChangeLog 2020-09-15 Tom Tromey * linux-x86-low.cc (xmltarget_i386_linux_no_xml) (xmltarget_amd64_linux_no_xml): Now arrays. --- gdb/jit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/jit.c') diff --git a/gdb/jit.c b/gdb/jit.c index 024c66e..5634c9e 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -45,9 +45,9 @@ static std::string jit_reader_dir; -static const char *const jit_break_name = "__jit_debug_register_code"; +static const char jit_break_name[] = "__jit_debug_register_code"; -static const char *const jit_descriptor_name = "__jit_debug_descriptor"; +static const char jit_descriptor_name[] = "__jit_debug_descriptor"; static void jit_inferior_init (struct gdbarch *gdbarch); static void jit_inferior_exit_hook (struct inferior *inf); @@ -173,7 +173,7 @@ struct jit_reader static struct jit_reader *loaded_jit_reader = NULL; typedef struct gdb_reader_funcs * (reader_init_fn_type) (void); -static const char *reader_init_fn_sym = "gdb_init_reader"; +static const char reader_init_fn_sym[] = "gdb_init_reader"; /* Try to load FILE_NAME as a JIT debug info reader. */ -- cgit v1.1