qemu-io: Move qemu_strsep() to cutils.c
authorKevin Wolf <kwolf@redhat.com>
Wed, 5 Jun 2013 12:19:35 +0000 (14:19 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 6 Jun 2013 09:27:04 +0000 (11:27 +0200)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
cmd.c
include/qemu-common.h
util/cutils.c

diff --git a/cmd.c b/cmd.c
index 8496e74d64eba7718d045e20b2b8c435eb4a90b3..f6bf2c5f9af335c453cff9e2c8f9f457d17260c4 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -255,27 +255,6 @@ fetchline(void)
 }
 #endif
 
-static char *qemu_strsep(char **input, const char *delim)
-{
-    char *result = *input;
-    if (result != NULL) {
-        char *p;
-
-        for (p = result; *p != '\0'; p++) {
-            if (strchr(delim, *p)) {
-                break;
-            }
-        }
-        if (*p == '\0') {
-            *input = NULL;
-        } else {
-            *p = '\0';
-            *input = p + 1;
-        }
-    }
-    return result;
-}
-
 char **breakline(char *input, int *count)
 {
     int c = 0;
index d95ea1e1473b834b43b9a2d71b650b79d50d6345..ed8b6e2005e0d2b16424d771d6ef923185bfb6d8 100644 (file)
@@ -174,6 +174,7 @@ char *pstrcat(char *buf, int buf_size, const char *s);
 int strstart(const char *str, const char *val, const char **ptr);
 int stristart(const char *str, const char *val, const char **ptr);
 int qemu_strnlen(const char *s, int max_len);
+char *qemu_strsep(char **input, const char *delim);
 time_t mktimegm(struct tm *tm);
 int qemu_fls(int i);
 int qemu_fdatasync(int fd);
index 8f28896843f26adda26eb4c63078814945384b53..0116fcde74f197f0d41b2f393c9fd7ae4c9de073 100644 (file)
@@ -107,6 +107,27 @@ int qemu_strnlen(const char *s, int max_len)
     return i;
 }
 
+char *qemu_strsep(char **input, const char *delim)
+{
+    char *result = *input;
+    if (result != NULL) {
+        char *p;
+
+        for (p = result; *p != '\0'; p++) {
+            if (strchr(delim, *p)) {
+                break;
+            }
+        }
+        if (*p == '\0') {
+            *input = NULL;
+        } else {
+            *p = '\0';
+            *input = p + 1;
+        }
+    }
+    return result;
+}
+
 time_t mktimegm(struct tm *tm)
 {
     time_t t;