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/unittests/memory-map-selftests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/unittests') diff --git a/gdb/unittests/memory-map-selftests.c b/gdb/unittests/memory-map-selftests.c index 42b5db6..0be5cb5 100644 --- a/gdb/unittests/memory-map-selftests.c +++ b/gdb/unittests/memory-map-selftests.c @@ -28,7 +28,7 @@ namespace memory_map_tests { /* A simple valid test input for parse_memory_map. */ -static const char *valid_mem_map = R"( +static const char valid_mem_map[] = R"( -- cgit v1.1