cryptospore / rpms / qemu-kvm

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