aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2012-10-26 12:47:06 +0100
committerPeter Stuge <peter@stuge.se>2012-10-28 01:40:21 +0000
commit538a86c3395d0476d2fdcc9bddc4e9e550734c96 (patch)
tree53aabde1956cc30f1d1198939375c88ad0b20d3c /src/target
parent6f65045b3791525e99d09d07b5f9d8dd5aa511e5 (diff)
gdb: use strncmp rather than strstr
All the packets received will be at start of the packet buffer, so use more efficient strncmp. Change-Id: Ib9c45d8f53425367006b1f880c1bde27f03a6cf9 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/932 Tested-by: jenkins Reviewed-by: Matthias Blaicher <matthias@blaicher.com> Reviewed-by: Peter Stuge <peter@stuge.se>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/smp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/smp.c b/src/target/smp.c
index 9cd4b013..ccbc2be4 100644
--- a/src/target/smp.c
+++ b/src/target/smp.c
@@ -65,7 +65,7 @@ int gdb_read_smp_packet(struct connection *connection,
char *hex_buffer;
int retval = ERROR_OK;
if (target->smp) {
- if (strstr(packet, "jc")) {
+ if (strncmp(packet, "jc", 2) == 0) {
hex_buffer = malloc(len * 2 + 1);
buffer = (uint8_t *)&target->gdb_service->core[0];
uint32_t i;
@@ -95,7 +95,7 @@ int gdb_write_smp_packet(struct connection *connection,
/* skip command character */
if (target->smp) {
- if (strstr(packet, "Jc")) {
+ if (strncmp(packet, "Jc", 2) == 0) {
packet += 2;
coreid = strtoul(packet, &separator, 16);
target->gdb_service->core[1] = coreid;