[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/26] qemu-io: Move qemu_strsep() to cutils.c
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 11/26] qemu-io: Move qemu_strsep() to cutils.c |
Date: |
Fri, 7 Jun 2013 13:58:30 +0200 |
From: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
cmd.c | 21 ---------------------
include/qemu-common.h | 1 +
util/cutils.c | 21 +++++++++++++++++++++
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/cmd.c b/cmd.c
index 8496e74..f6bf2c5 100644
--- 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;
diff --git a/include/qemu-common.h b/include/qemu-common.h
index d95ea1e..ed8b6e2 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -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);
diff --git a/util/cutils.c b/util/cutils.c
index 8f28896..0116fcd 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -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;
--
1.8.1.4
- [Qemu-devel] [PULL 00/26] Block patches, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 01/26] blockdev: reset werror/rerror on drive_del, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 02/26] qemu-io: Remove unused args_command, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 03/26] cutils: Support 'P' and 'E' suffixes in strtosz(), Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 04/26] qemu-io: Make cvtnum() a wrapper around strtosz_suffix(), Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 05/26] qemu-io: Handle cvtnum() errors in 'alloc', Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 06/26] qemu-io: Don't use global bs in command implementations, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 08/26] qemu-io: Factor out qemuio_command, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 09/26] qemu-io: Move 'help' function, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 11/26] qemu-io: Move qemu_strsep() to cutils.c,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 10/26] qemu-io: Move 'quit' function, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 07/26] qemu-io: Split off commands to qemu-io-cmds.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 12/26] qemu-io: Move functions for registering and running commands, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 13/26] qemu-io: Move command_loop() and friends, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 14/26] qemu-io: Move remaining helpers from cmd.c, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 15/26] qemu-io: Interface cleanup, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 16/26] qemu-io: Use the qemu version for -V, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 17/26] Make qemu-io commands available in HMP, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 18/26] blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events, Stefan Hajnoczi, 2013/06/07
- [Qemu-devel] [PULL 19/26] ide-test: Add enum value for DEV, Stefan Hajnoczi, 2013/06/07