This is the mail archive of the gdb-patches@sources.redhat.com 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]

[patch/comiting] Some ``char *'' -> ``const void *'' in regcache


Hello,

This just cleans up some of the regcache interfaces so that they are easier to use. No longer is a cast like:

supply_register (...., (char *) &buf, ...);

needed.

committing,
Andrew
2002-07-24  Andrew Cagney  <cagney@redhat.com>

	* regcache.c (regcache_raw_write): Change buf parameter to a
	constant void pointer.
	(regcache_raw_read): Change buf parameter to a void pointer.
	(legacy_write_register_gen): Change myaddr parameter a constant
	void pointer.
	(supply_register): Change val parameter to a const void pointer.
	* regcache.h (regcache_raw_write): Update declaration.
	(regcache_raw_read): Update declaration.
	(supply_register): Update declaration.

Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.41
diff -u -r1.41 regcache.c
--- regcache.c	24 Jul 2002 14:38:55 -0000	1.41
+++ regcache.c	24 Jul 2002 16:55:24 -0000
@@ -671,7 +671,7 @@
 }
 
 void
-regcache_raw_read (struct regcache *regcache, int regnum, char *buf)
+regcache_raw_read (struct regcache *regcache, int regnum, void *buf)
 {
   gdb_assert (regcache != NULL && buf != NULL);
   gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
@@ -724,7 +724,7 @@
    REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order.  */
 
 static void
-legacy_write_register_gen (int regnum, char *myaddr)
+legacy_write_register_gen (int regnum, const void *myaddr)
 {
   int size;
   gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
@@ -761,7 +761,7 @@
 }
 
 void
-regcache_raw_write (struct regcache *regcache, int regnum, char *buf)
+regcache_raw_write (struct regcache *regcache, int regnum, const void *buf)
 {
   gdb_assert (regcache != NULL && buf != NULL);
   gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
@@ -987,7 +987,7 @@
    fact, and report it to the users of read_register and friends.  */
 
 void
-supply_register (int regnum, char *val)
+supply_register (int regnum, const void *val)
 {
 #if 1
   if (! ptid_equal (registers_ptid, inferior_ptid))
Index: regcache.h
===================================================================
RCS file: /cvs/src/src/gdb/regcache.h,v
retrieving revision 1.10
diff -u -r1.10 regcache.h
--- regcache.h	24 Jul 2002 14:38:55 -0000	1.10
+++ regcache.h	24 Jul 2002 16:55:24 -0000
@@ -35,8 +35,9 @@
 /* Transfer a raw register [0..NUM_REGS) between core-gdb and the
    regcache. */
 
-void regcache_raw_read (struct regcache *regcache, int rawnum, char *buf);
-void regcache_raw_write (struct regcache *regcache, int rawnum, char *buf);
+void regcache_raw_read (struct regcache *regcache, int rawnum, void *buf);
+void regcache_raw_write (struct regcache *regcache, int rawnum,
+			 const void *buf);
 int regcache_valid_p (struct regcache *regcache, int regnum);
 CORE_ADDR regcache_raw_read_as_address (struct regcache *regcache, int rawnum);
 
@@ -44,7 +45,7 @@
    target.  These functions are called by the target in response to a
    target_fetch_registers() or target_store_registers().  */
 
-extern void supply_register (int regnum, char *val);
+extern void supply_register (int regnum, const void *val);
 extern void regcache_collect (int regnum, void *buf);
 
 

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