From patchwork Mon Mar 25 19:40:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 230981 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 10EDC2C00A6 for ; Tue, 26 Mar 2013 06:41:21 +1100 (EST) Received: from localhost ([::1]:34435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKDGh-0007R7-AB for incoming@patchwork.ozlabs.org; Mon, 25 Mar 2013 15:41:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKDGF-0007Pr-D1 for qemu-devel@nongnu.org; Mon, 25 Mar 2013 15:40:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKDG9-00086E-0Q for qemu-devel@nongnu.org; Mon, 25 Mar 2013 15:40:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKDG8-00085q-Bc for qemu-devel@nongnu.org; Mon, 25 Mar 2013 15:40:44 -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 r2PJegVp015469 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 25 Mar 2013 15:40:42 -0400 Received: from localhost (ovpn-113-111.phx2.redhat.com [10.3.113.111]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2PJefWD022522; Mon, 25 Mar 2013 15:40:42 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 25 Mar 2013 15:40:38 -0400 Message-Id: <1364240439-23450-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1364240439-23450-1-git-send-email-lcapitulino@redhat.com> References: <1364240439-23450-1-git-send-email-lcapitulino@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: kraxel@redhat.com, fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH 1/2] qstring: add qobject_get_length() 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 Long overdue. Signed-off-by: Luiz Capitulino --- include/qapi/qmp/qstring.h | 1 + qobject/qstring.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h index 0e690f4..1bc3666 100644 --- a/include/qapi/qmp/qstring.h +++ b/include/qapi/qmp/qstring.h @@ -26,6 +26,7 @@ typedef struct QString { QString *qstring_new(void); QString *qstring_from_str(const char *str); QString *qstring_from_substr(const char *str, int start, int end); +size_t qstring_get_length(const QString *qstring); const char *qstring_get_str(const QString *qstring); void qstring_append_int(QString *qstring, int64_t value); void qstring_append(QString *qstring, const char *str); diff --git a/qobject/qstring.c b/qobject/qstring.c index 5f7376c..607b7a1 100644 --- a/qobject/qstring.c +++ b/qobject/qstring.c @@ -32,6 +32,14 @@ QString *qstring_new(void) } /** + * qstring_get_length(): Get the length of a QString + */ +size_t qstring_get_length(const QString *qstring) +{ + return qstring->length; +} + +/** * qstring_from_substr(): Create a new QString from a C string substring * * Return string reference