From patchwork Tue May 28 15:27:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 246912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 698C52C02A7 for ; Wed, 29 May 2013 01:41:19 +1000 (EST) Received: from localhost ([::1]:33158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhLuG-0003Vh-QJ for incoming@patchwork.ozlabs.org; Tue, 28 May 2013 11:33:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhLpe-0004qW-7W for qemu-devel@nongnu.org; Tue, 28 May 2013 11:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhLpX-0007YQ-UC for qemu-devel@nongnu.org; Tue, 28 May 2013 11:29:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhLpX-0007YL-Lq for qemu-devel@nongnu.org; Tue, 28 May 2013 11:28:55 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4SFStHh018525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 May 2013 11:28:55 -0400 Received: from dhcp-200-207.str.redhat.com (dhcp-192-246.str.redhat.com [10.33.192.246]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4SFSLx3012016; Tue, 28 May 2013 11:28:53 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Tue, 28 May 2013 17:27:30 +0200 Message-Id: <1369754856-30036-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1369754856-30036-1-git-send-email-kwolf@redhat.com> References: <1369754856-30036-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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 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;