This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] [patch] Code cleanup: constify struct target_so_ops handling


On Thu, 28 Mar 2013 15:28:31 +0100, Jan Kratochvil wrote:
> I will check it in.  I haven't seen it in tromey/constify.

Checked in with a small update for new clear_so.


Jan


http://sourceware.org/ml/gdb-cvs/2013-05/msg00198.html

### src/gdb/ChangeLog	2013/05/21 06:50:12	1.15607
### src/gdb/ChangeLog	2013/05/21 08:16:10	1.15608
## -1,3 +1,15 @@
+2013-05-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Code cleanup: constification.
+	* solib.c (solib_ops): Make return type and ops variable type const.
+	(set_solib_ops): Make the new_ops parameter and ops variable const.
+	(solib_find, solib_map_sections, clear_so, free_so, update_solib_list)
+	(solib_add, solib_keep_data_in_core, clear_solib)
+	(solib_create_inferior_hook, in_solib_dynsym_resolve_code)
+	(reload_shared_libraries, solib_global_lookup): Make the ops variable
+	const.
+	* solib.h (set_solib_ops): Make the new_ops parameter const.
+
 2013-05-21  Joel Brobecker  <brobecker@adacore.com>
 
 	* data-directory/Makefile.in (SYSTEM_GDBINIT_SRCDIR): New
--- src/gdb/solib.c	2013/05/06 22:18:39	1.173
+++ src/gdb/solib.c	2013/05/21 08:16:10	1.174
@@ -64,10 +64,10 @@
   return ops;
 }
 
-static struct target_so_ops *
+static const struct target_so_ops *
 solib_ops (struct gdbarch *gdbarch)
 {
-  struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+  const struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
 
   return *ops;
 }
@@ -75,9 +75,9 @@
 /* Set the solib operations for GDBARCH to NEW_OPS.  */
 
 void
-set_solib_ops (struct gdbarch *gdbarch, struct target_so_ops *new_ops)
+set_solib_ops (struct gdbarch *gdbarch, const struct target_so_ops *new_ops)
 {
-  struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
+  const struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
 
   *ops = new_ops;
 }
@@ -144,7 +144,7 @@
 char *
 solib_find (char *in_pathname, int *fd)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
   int found_file = -1;
   char *temp_pathname = NULL;
   int gdb_sysroot_is_empty;
@@ -449,7 +449,7 @@
 static int
 solib_map_sections (struct so_list *so)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
   char *filename;
   struct target_section *p;
   struct cleanup *old_chain;
@@ -511,7 +511,7 @@
 static void
 clear_so (struct so_list *so)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   if (so->sections)
     {
@@ -551,7 +551,7 @@
 void
 free_so (struct so_list *so)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   clear_so (so);
   ops->free_so (so);
@@ -670,7 +670,7 @@
 static void
 update_solib_list (int from_tty, struct target_ops *target)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
   struct so_list *inferior = ops->current_sos();
   struct so_list *gdb, **gdb_link;
 
@@ -932,7 +932,7 @@
 
     if (loaded_any_symbols)
       {
-	struct target_so_ops *ops = solib_ops (target_gdbarch ());
+	const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
 	/* Getting new symbols may change our opinion about what is
 	   frameless.  */
@@ -1105,7 +1105,7 @@
 int
 solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   if (ops->keep_data_in_core)
     return ops->keep_data_in_core (vaddr, size);
@@ -1118,7 +1118,7 @@
 void
 clear_solib (void)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   /* This function is expected to handle ELF shared libraries.  It is
      also used on Solaris, which can run either ELF or a.out binaries
@@ -1166,7 +1166,7 @@
 void
 solib_create_inferior_hook (int from_tty)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   ops->solib_create_inferior_hook (from_tty);
 }
@@ -1177,7 +1177,7 @@
 int
 in_solib_dynsym_resolve_code (CORE_ADDR pc)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   return ops->in_dynsym_resolve_code (pc);
 }
@@ -1275,7 +1275,7 @@
 reload_shared_libraries (char *ignored, int from_tty,
 			 struct cmd_list_element *e)
 {
-  struct target_so_ops *ops;
+  const struct target_so_ops *ops;
 
   reload_shared_libraries_1 (from_tty);
 
@@ -1342,7 +1342,7 @@
 		     const char *name,
 		     const domain_enum domain)
 {
-  struct target_so_ops *ops = solib_ops (target_gdbarch ());
+  const struct target_so_ops *ops = solib_ops (target_gdbarch ());
 
   if (ops->lookup_lib_global_symbol != NULL)
     return ops->lookup_lib_global_symbol (objfile, name, domain);
--- src/gdb/solib.h	2013/01/01 06:32:51	1.34
+++ src/gdb/solib.h	2013/05/21 08:16:10	1.35
@@ -71,7 +71,7 @@
 /* Set the solib operations for GDBARCH to NEW_OPS.  */
 
 extern void set_solib_ops (struct gdbarch *gdbarch,
-			   struct target_so_ops *new_ops);
+			   const struct target_so_ops *new_ops);
 
 /* Return non-zero if NAME is the libpthread shared library.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]