From bfada1897a1f8d2f46c99c333122590f57f1ff08 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 22 Feb 2013 16:40:56 +0000 Subject: [PATCH] gdb/ Code cleanup. * elfread.c (build_id_bfd_get): Make the return type const. (build_id_verify): Make the check parameter const. (build_id_to_debug_filename): Make the build_id parameter and variable data const. (find_separate_debug_file_by_buildid): Make the variable build_id const. --- gdb/ChangeLog | 9 +++++++++ gdb/elfread.c | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a0c78441a76..d853da03273 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2013-02-22 Jan Kratochvil + + Code cleanup. + * elfread.c (build_id_bfd_get): Make the return type const. + (build_id_verify): Make the check parameter const. + (build_id_to_debug_filename): Make the build_id parameter and variable + data const. + (find_separate_debug_file_by_buildid): Make the variable build_id const. + 2013-02-21 Alan Modra * elfread.c (build_id_bfd_get): Adjust for elf_tdata changes. diff --git a/gdb/elfread.c b/gdb/elfread.c index 4520209b61e..4b9562715cb 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1076,7 +1076,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) /* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ -static struct elf_build_id * +static const struct elf_build_id * build_id_bfd_get (bfd *abfd) { if (!bfd_check_format (abfd, bfd_object) @@ -1090,10 +1090,10 @@ build_id_bfd_get (bfd *abfd) /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -build_id_verify (const char *filename, struct elf_build_id *check) +build_id_verify (const char *filename, const struct elf_build_id *check) { bfd *abfd; - struct elf_build_id *found; + const struct elf_build_id *found; int retval = 0; /* We expect to be silent on the non-existing files. */ @@ -1118,7 +1118,7 @@ build_id_verify (const char *filename, struct elf_build_id *check) } static char * -build_id_to_debug_filename (struct elf_build_id *build_id) +build_id_to_debug_filename (const struct elf_build_id *build_id) { char *link, *debugdir, *retval = NULL; VEC (char_ptr) *debugdir_vec; @@ -1138,7 +1138,7 @@ build_id_to_debug_filename (struct elf_build_id *build_id) for (ix = 0; VEC_iterate (char_ptr, debugdir_vec, ix, debugdir); ++ix) { size_t debugdir_len = strlen (debugdir); - gdb_byte *data = build_id->data; + const gdb_byte *data = build_id->data; size_t size = build_id->size; char *s; @@ -1177,7 +1177,7 @@ build_id_to_debug_filename (struct elf_build_id *build_id) static char * find_separate_debug_file_by_buildid (struct objfile *objfile) { - struct elf_build_id *build_id; + const struct elf_build_id *build_id; build_id = build_id_bfd_get (objfile->obfd); if (build_id != NULL) -- 2.30.2