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]

[PATCH] Small cleanup of GDBSERVER code


The following are some cleanups to the GSBSERVER code.

2001-04-26  John S Kallal  <jskallal@home.com>

 * server.c (main): Removed unneeded local variable.
 * remote-utils.c (input_interrupt): Added unused
 calling argument to match single UNIX specification.
 * remote-utils.c (remote_open, putpkt, convert_int_to_ascii,
 convert_ascii_to_int): Changed a calling argument pointer
 from char * to const char *.
 * server.h: Likewise changes to the function prototypes.







diff -u -r gdb-org/gdbserver/remote-utils.c gdb/gdbserver/remote-utils.c
--- gdb-org/gdbserver/remote-utils.c Tue Mar  6 03:21:44 2001
+++ gdb/gdbserver/remote-utils.c Thu Apr 26 10:58:20 2001
@@ -42,7 +42,7 @@
    NAME is the filename used for communication.  */

 void
-remote_open (char *name)
+remote_open (const char *name)
 {
   int save_fcntl_flags;

@@ -195,7 +195,7 @@
    The data of the packet is in BUF.  Returns >= 0 on success, -1
otherwise. */

 int
-putpkt (char *buf)
+putpkt (const char *buf)
 {
   int i;
   unsigned char csum = 0;
@@ -259,7 +259,7 @@
    will cause us to send a SIGINT to the child.  */

 static void
-input_interrupt (void)
+input_interrupt ( int unused )
 {
   int cc;
   char c;
@@ -393,7 +393,7 @@
 }

 void
-convert_int_to_ascii (char *from, char *to, int n)
+convert_int_to_ascii (const char *from, char *to, int n)
 {
   int nib;
   char ch;
@@ -410,7 +410,7 @@


 void
-convert_ascii_to_int (char *from, char *to, int n)
+convert_ascii_to_int (const char *from, char *to, int n)
 {
   int nib1, nib2;
   while (n--)
@@ -497,7 +497,7 @@
 }

 void
-decode_m_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int
*len_ptr)
+decode_m_packet (const char *from, CORE_ADDR *mem_addr_ptr, unsigned int
*len_ptr)
 {
   int i = 0, j = 0;
   char ch;
@@ -519,7 +519,7 @@
 }

 void
-decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int
*len_ptr,
+decode_M_packet (const char *from, CORE_ADDR *mem_addr_ptr, unsigned int
*len_ptr,
    char *to)
 {
   int i = 0;
diff -u -r gdb-org/gdbserver/server.c gdb/gdbserver/server.c
--- gdb-org/gdbserver/server.c Tue Mar  6 03:21:44 2001
+++ gdb/gdbserver/server.c Thu Apr 26 10:29:20 2001
@@ -45,7 +45,6 @@
 main (int argc, char *argv[])
 {
   char ch, status, own_buf[PBUFSIZ], mem_buf[2000];
-  int i = 0;
   unsigned char signal;
   unsigned int len;
   CORE_ADDR mem_addr;
@@ -75,8 +74,7 @@
       while (getpkt (own_buf) > 0)
  {
    unsigned char sig;
-   i = 0;
-   ch = own_buf[i++];
+   ch = own_buf[0];
    switch (ch)
      {
      case 'd':
diff -u -r gdb-org/gdbserver/server.h gdb/gdbserver/server.h
--- gdb-org/gdbserver/server.h Tue Mar  6 03:21:44 2001
+++ gdb/gdbserver/server.h Thu Apr 26 14:22:46 2001
@@ -33,8 +33,7 @@
 unsigned char mywait (char *status);
 void read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
 int write_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len);
-int create_inferior ();
-void initialize_low ();
+void initialize_low (void);

 /* Target-specific variables */

@@ -52,21 +51,21 @@

 /* Functions from remote-utils.c */

-int putpkt (char *buf);
+int putpkt (const char *buf);
 int getpkt (char *buf);
-void remote_open (char *name);
+void remote_open (const char *name);
 void remote_close (void);
 void write_ok (char *buf);
 void write_enn (char *buf);
 void enable_async_io (void);
 void disable_async_io (void);
-void convert_ascii_to_int (char *from, char *to, int n);
-void convert_int_to_ascii (char *from, char *to, int n);
+void convert_ascii_to_int (const char *from, char *to, int n);
+void convert_int_to_ascii (const char *from, char *to, int n);
 void prepare_resume_reply (char *buf, char status, unsigned char sig);

-void decode_m_packet (char *from, CORE_ADDR * mem_addr_ptr,
+void decode_m_packet (const char *from, CORE_ADDR * mem_addr_ptr,
         unsigned int *len_ptr);
-void decode_M_packet (char *from, CORE_ADDR * mem_addr_ptr,
+void decode_M_packet (const char *from, CORE_ADDR * mem_addr_ptr,
         unsigned int *len_ptr, char *to);





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