aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/hostio.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2015-03-06 09:42:06 +0000
committerGary Benson <gbenson@redhat.com>2015-03-06 09:42:06 +0000
commit61012eef8463764ccd9117dc1c9bc43cc452b7cc (patch)
treef576a77bcb77e71cc60e6592b56d2aa915b50c36 /gdb/gdbserver/hostio.c
parente80417caef36c7d5e3d1da6a3b396a872d9d7201 (diff)
downloadfsf-binutils-gdb-61012eef8463764ccd9117dc1c9bc43cc452b7cc.zip
fsf-binutils-gdb-61012eef8463764ccd9117dc1c9bc43cc452b7cc.tar.gz
fsf-binutils-gdb-61012eef8463764ccd9117dc1c9bc43cc452b7cc.tar.bz2
New common function "startswith"
This commit introduces a new inline common function "startswith" which takes two string arguments and returns nonzero if the first string starts with the second. It also updates the 295 places where this logic was written out longhand to use the new function. gdb/ChangeLog: * common/common-utils.h (startswith): New inline function. All places where this logic was used updated to use the above.
Diffstat (limited to 'gdb/gdbserver/hostio.c')
-rw-r--r--gdb/gdbserver/hostio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index e6b7754..ec29eb9 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -511,17 +511,17 @@ handle_readlink (char *own_buf, int *new_packet_len)
int
handle_vFile (char *own_buf, int packet_len, int *new_packet_len)
{
- if (strncmp (own_buf, "vFile:open:", 11) == 0)
+ if (startswith (own_buf, "vFile:open:"))
handle_open (own_buf);
- else if (strncmp (own_buf, "vFile:pread:", 12) == 0)
+ else if (startswith (own_buf, "vFile:pread:"))
handle_pread (own_buf, new_packet_len);
- else if (strncmp (own_buf, "vFile:pwrite:", 13) == 0)
+ else if (startswith (own_buf, "vFile:pwrite:"))
handle_pwrite (own_buf, packet_len);
- else if (strncmp (own_buf, "vFile:close:", 12) == 0)
+ else if (startswith (own_buf, "vFile:close:"))
handle_close (own_buf);
- else if (strncmp (own_buf, "vFile:unlink:", 13) == 0)
+ else if (startswith (own_buf, "vFile:unlink:"))
handle_unlink (own_buf);
- else if (strncmp (own_buf, "vFile:readlink:", 15) == 0)
+ else if (startswith (own_buf, "vFile:readlink:"))
handle_readlink (own_buf, new_packet_len);
else
return 0;