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]: cleanup bin2hex function


Checking this change in separately, per Andrew's approval.  
Add a small white-space fix-up.
2001-05-14  Michael Snyder  <msnyder@redhat.com>

	* remote.c (hex2bin): 	Make first argument const.
	Require explicit count, don't accept null-terminated str.
	(remote_resume, remote_async_resume): White space fix-up.
  
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 remote.c
*** remote.c	2001/05/14 18:31:35	1.51
--- remote.c	2001/05/14 18:57:39
*************** static int fromhex (int a);
*** 190,195 ****
--- 190,197 ----
  
  static int hex2bin (const char *hex, char *bin, int);
  
+ static int bin2hex (const char *bin, char *hex, int);
+ 
  static int putpkt_binary (char *buf, int cnt);
  
  static void check_binary_download (CORE_ADDR addr);
*************** hex2bin (const char *hex, char *bin, int
*** 2346,2355 ****
  {
    int i;
  
-   /* May use a length, or a nul-terminated string as input. */
-   if (count == 0)
-     count = strlen (hex) / 2;
- 
    for (i = 0; i < count; i++)
      {
        if (hex[0] == 0 || hex[1] == 0)
--- 2348,2353 ----
*************** tohex (int nib)
*** 2376,2382 ****
  }
  
  static int
! bin2hex (char *bin, char *hex, int count)
  {
    int i;
    /* May use a length, or a nul-terminated string as input. */
--- 2374,2380 ----
  }
  
  static int
! bin2hex (const char *bin, char *hex, int count)
  {
    int i;
    /* May use a length, or a nul-terminated string as input. */
*************** remote_resume (ptid_t ptid, int step, en
*** 2449,2455 ****
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok(buf, &remote_protocol_E) == PACKET_OK)
  		return;
  	    }
  	}
--- 2447,2453 ----
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
  		return;
  	    }
  	}
*************** remote_resume (ptid_t ptid, int step, en
*** 2467,2473 ****
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok(buf, &remote_protocol_e) == PACKET_OK)
  		return;
  	    }
  	}
--- 2465,2471 ----
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
  		return;
  	    }
  	}
*************** remote_async_resume (ptid_t ptid, int st
*** 2537,2543 ****
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok(buf, &remote_protocol_E) == PACKET_OK)
  		goto register_event_loop;
  	    }
  	}
--- 2535,2541 ----
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok (buf, &remote_protocol_E) == PACKET_OK)
  		goto register_event_loop;
  	    }
  	}
*************** remote_async_resume (ptid_t ptid, int st
*** 2555,2561 ****
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok(buf, &remote_protocol_e) == PACKET_OK)
  		goto register_event_loop;
  	    }
  	}
--- 2553,2559 ----
  	      putpkt (buf);
  	      getpkt (buf, PBUFSIZ, 0);
  
! 	      if (packet_ok (buf, &remote_protocol_e) == PACKET_OK)
  		goto register_event_loop;
  	    }
  	}


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