[1/3] Constify get_disassembler_options

Message ID 20240321-disassemble-cleanup-v1-1-77448506f4ab@adacore.com
State New
Headers
Series Minor cleanups in disassemble code |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom Tromey March 21, 2024, 6:10 p.m. UTC
  This changes get_disassembler_options to return a const char *.
---
 gdb/arm-tdep.c | 2 +-
 gdb/disasm.c   | 2 +-
 gdb/disasm.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 3b4ae15df07..82b06f63fcb 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9640,7 +9640,7 @@  show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
 			      struct cmd_list_element *c, const char *value)
 {
   struct gdbarch *gdbarch = get_current_arch ();
-  char *options = get_disassembler_options (gdbarch);
+  const char *options = get_disassembler_options (gdbarch);
   const char *style = "";
   int len = 0;
   const char *opt;
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 15d641cfc1f..5bab5cf6199 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1291,7 +1291,7 @@  gdb_buffered_insn_length (struct gdbarch *gdbarch,
   return result;
 }
 
-char *
+const char *
 get_disassembler_options (struct gdbarch *gdbarch)
 {
   char **disassembler_options = gdbarch_disassembler_options (gdbarch);
diff --git a/gdb/disasm.h b/gdb/disasm.h
index a2251445707..9282632b270 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -385,7 +385,7 @@  extern int gdb_buffered_insn_length (struct gdbarch *gdbarch,
 
 /* Returns GDBARCH's disassembler options.  */
 
-extern char *get_disassembler_options (struct gdbarch *gdbarch);
+extern const char *get_disassembler_options (struct gdbarch *gdbarch);
 
 /* Sets the active gdbarch's disassembler options to OPTIONS.  */