From patchwork Wed Jun 5 12:19:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 249011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4D76B2C009E for ; Wed, 5 Jun 2013 22:24:06 +1000 (EST) Received: from localhost ([::1]:59532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkCl2-00015D-Bq for incoming@patchwork.ozlabs.org; Wed, 05 Jun 2013 08:24:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkChY-00055d-Nx for qemu-devel@nongnu.org; Wed, 05 Jun 2013 08:20:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkChS-0004ia-Ua for qemu-devel@nongnu.org; Wed, 05 Jun 2013 08:20:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkChS-0004i3-Lr for qemu-devel@nongnu.org; Wed, 05 Jun 2013 08:20:22 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r55CKJ8C023910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Jun 2013 08:20:19 -0400 Received: from dhcp-200-207.str.redhat.com (dhcp-192-246.str.redhat.com [10.33.192.246]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r55CJig6018138; Wed, 5 Jun 2013 08:20:01 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Wed, 5 Jun 2013 14:19:35 +0200 Message-Id: <1370434781-28570-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1370434781-28570-1-git-send-email-kwolf@redhat.com> References: <1370434781-28570-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v2 10/16] qemu-io: Move qemu_strsep() to cutils.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- 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;