aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/monitor.c b/monitor.c
index 0988eb4788..7b473aad1f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -820,9 +820,7 @@ static int compare_cmd(const char *name, const char *list)
p = list;
for(;;) {
pstart = p;
- p = strchr(p, '|');
- if (!p)
- p = pstart + strlen(pstart);
+ p = qemu_strchrnul(p, '|');
if ((p - pstart) == len && !memcmp(pstart, name, len))
return 1;
if (*p == '\0')
@@ -3491,9 +3489,7 @@ static void cmd_completion(Monitor *mon, const char *name, const char *list)
p = list;
for(;;) {
pstart = p;
- p = strchr(p, '|');
- if (!p)
- p = pstart + strlen(pstart);
+ p = qemu_strchrnul(p, '|');
len = p - pstart;
if (len > sizeof(cmd) - 2)
len = sizeof(cmd) - 2;