diff options
Diffstat (limited to 'monitor.c')
| -rw-r--r-- | monitor.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/monitor.c b/monitor.c index 0730a27172..80af6a9390 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') @@ -3489,9 +3487,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; |