From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkvKA-0001EH-9v for qemu-devel@nongnu.org; Fri, 07 Jun 2013 07:59:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkvK7-0004Jp-Mu for qemu-devel@nongnu.org; Fri, 07 Jun 2013 07:59:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkvK7-0004Jf-F2 for qemu-devel@nongnu.org; Fri, 07 Jun 2013 07:59:15 -0400 From: Stefan Hajnoczi Date: Fri, 7 Jun 2013 13:58:30 +0200 Message-Id: <1370606325-10680-12-git-send-email-stefanha@redhat.com> In-Reply-To: <1370606325-10680-1-git-send-email-stefanha@redhat.com> References: <1370606325-10680-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 11/26] qemu-io: Move qemu_strsep() to cutils.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi From: Kevin Wolf Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- 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