[PATCH] Use arrays rather than pointers for global string constants
Kevin Buettner
kevinb@redhat.com
Sat Jul 25 00:26:38 GMT 2020
On Wed, 22 Jul 2020 14:36:13 -0600
Tom Tromey <tromey@adacore.com> wrote:
> 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-07-22 Tom Tromey <tromey@adacore.com>
>
> * 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.
LGTM.
Kevin
More information about the Gdb-patches
mailing list