9ae3a8
From 4ab2a72fcfc65bd78cf60e6e5a29e2189fddf877 Mon Sep 17 00:00:00 2001
9ae3a8
From: John Snow <jsnow@redhat.com>
9ae3a8
Date: Mon, 23 Nov 2015 17:38:29 +0100
9ae3a8
Subject: [PATCH 10/27] qemu-io: Move qemu_strsep() to cutils.c
9ae3a8
9ae3a8
RH-Author: John Snow <jsnow@redhat.com>
9ae3a8
Message-id: <1448300320-7772-11-git-send-email-jsnow@redhat.com>
9ae3a8
Patchwork-id: 68440
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH v2 10/21] qemu-io: Move qemu_strsep() to cutils.c
9ae3a8
Bugzilla: 1272523
9ae3a8
RH-Acked-by: Thomas Huth <thuth@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit a38ed811474e953371f848233208c2026c2d1195)
9ae3a8
Signed-off-by: John Snow <jsnow@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 cmd.c                 | 21 ---------------------
9ae3a8
 include/qemu-common.h |  1 +
9ae3a8
 util/cutils.c         | 21 +++++++++++++++++++++
9ae3a8
 3 files changed, 22 insertions(+), 21 deletions(-)
9ae3a8
9ae3a8
diff --git a/cmd.c b/cmd.c
9ae3a8
index 8496e74..f6bf2c5 100644
9ae3a8
--- a/cmd.c
9ae3a8
+++ b/cmd.c
9ae3a8
@@ -255,27 +255,6 @@ fetchline(void)
9ae3a8
 }
9ae3a8
 #endif
9ae3a8
 
9ae3a8
-static char *qemu_strsep(char **input, const char *delim)
9ae3a8
-{
9ae3a8
-    char *result = *input;
9ae3a8
-    if (result != NULL) {
9ae3a8
-        char *p;
9ae3a8
-
9ae3a8
-        for (p = result; *p != '\0'; p++) {
9ae3a8
-            if (strchr(delim, *p)) {
9ae3a8
-                break;
9ae3a8
-            }
9ae3a8
-        }
9ae3a8
-        if (*p == '\0') {
9ae3a8
-            *input = NULL;
9ae3a8
-        } else {
9ae3a8
-            *p = '\0';
9ae3a8
-            *input = p + 1;
9ae3a8
-        }
9ae3a8
-    }
9ae3a8
-    return result;
9ae3a8
-}
9ae3a8
-
9ae3a8
 char **breakline(char *input, int *count)
9ae3a8
 {
9ae3a8
     int c = 0;
9ae3a8
diff --git a/include/qemu-common.h b/include/qemu-common.h
9ae3a8
index 67f57c9..8c1132c 100644
9ae3a8
--- a/include/qemu-common.h
9ae3a8
+++ b/include/qemu-common.h
9ae3a8
@@ -161,6 +161,7 @@ char *pstrcat(char *buf, int buf_size, const char *s);
9ae3a8
 int strstart(const char *str, const char *val, const char **ptr);
9ae3a8
 int stristart(const char *str, const char *val, const char **ptr);
9ae3a8
 int qemu_strnlen(const char *s, int max_len);
9ae3a8
+char *qemu_strsep(char **input, const char *delim);
9ae3a8
 time_t mktimegm(struct tm *tm);
9ae3a8
 int qemu_fls(int i);
9ae3a8
 int qemu_fdatasync(int fd);
9ae3a8
diff --git a/util/cutils.c b/util/cutils.c
9ae3a8
index 8f28896..0116fcd 100644
9ae3a8
--- a/util/cutils.c
9ae3a8
+++ b/util/cutils.c
9ae3a8
@@ -107,6 +107,27 @@ int qemu_strnlen(const char *s, int max_len)
9ae3a8
     return i;
9ae3a8
 }
9ae3a8
 
9ae3a8
+char *qemu_strsep(char **input, const char *delim)
9ae3a8
+{
9ae3a8
+    char *result = *input;
9ae3a8
+    if (result != NULL) {
9ae3a8
+        char *p;
9ae3a8
+
9ae3a8
+        for (p = result; *p != '\0'; p++) {
9ae3a8
+            if (strchr(delim, *p)) {
9ae3a8
+                break;
9ae3a8
+            }
9ae3a8
+        }
9ae3a8
+        if (*p == '\0') {
9ae3a8
+            *input = NULL;
9ae3a8
+        } else {
9ae3a8
+            *p = '\0';
9ae3a8
+            *input = p + 1;
9ae3a8
+        }
9ae3a8
+    }
9ae3a8
+    return result;
9ae3a8
+}
9ae3a8
+
9ae3a8
 time_t mktimegm(struct tm *tm)
9ae3a8
 {
9ae3a8
     time_t t;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8