From patchwork Thu Nov 12 20:42:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 38280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F2CBB7BAF for ; Fri, 13 Nov 2009 07:57:40 +1100 (EST) Received: from localhost ([127.0.0.1]:60907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8gjZ-0008Up-Fi for incoming@patchwork.ozlabs.org; Thu, 12 Nov 2009 15:57:37 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8gVR-0007po-JT for qemu-devel@nongnu.org; Thu, 12 Nov 2009 15:43:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8gVN-0007mo-3d for qemu-devel@nongnu.org; Thu, 12 Nov 2009 15:43:01 -0500 Received: from [199.232.76.173] (port=33538 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8gVM-0007mc-MW for qemu-devel@nongnu.org; Thu, 12 Nov 2009 15:42:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1241) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8gVM-0006h9-8i for qemu-devel@nongnu.org; Thu, 12 Nov 2009 15:42:56 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nACKgtiB010033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Nov 2009 15:42:55 -0500 Received: from localhost (vpn-10-7.rdu.redhat.com [10.11.10.7]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nACKgsot028768; Thu, 12 Nov 2009 15:42:54 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 12 Nov 2009 18:42:28 -0200 Message-Id: <1258058554-22872-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1258058554-22872-1-git-send-email-lcapitulino@redhat.com> References: <1258058554-22872-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, kraxel@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 3/9] QString: Introduce qstring_append_int() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Luiz Capitulino --- qstring.c | 8 ++++++++ qstring.h | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/qstring.c b/qstring.c index e422bd9..ad17769 100644 --- a/qstring.c +++ b/qstring.c @@ -75,6 +75,14 @@ void qstring_append(QString *qstring, const char *str) qstring->string[qstring->length] = 0; } +void qstring_append_int(QString *qstring, int64_t value) +{ + char num[32]; + + snprintf(num, sizeof(num), "%" PRId64, value); + qstring_append(qstring, num); +} + /** * qstring_append_chr(): Append a C char to a QString */ diff --git a/qstring.h b/qstring.h index 43581de..c065331 100644 --- a/qstring.h +++ b/qstring.h @@ -1,6 +1,7 @@ #ifndef QSTRING_H #define QSTRING_H +#include #include "qobject.h" typedef struct QString { @@ -13,6 +14,7 @@ typedef struct QString { QString *qstring_new(void); QString *qstring_from_str(const char *str); 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); void qstring_append_chr(QString *qstring, int c); QString *qobject_to_qstring(const QObject *obj);