Received: from eggs.gnu.org ([140.186.70.92]:57352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhHfb-00079X-1L for qemu-devel@nongnu.org; Thu, 14 Jul 2011 04:53:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QhHfW-0003sU-7b for qemu-devel@nongnu.org; Thu, 14 Jul 2011 04:53:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QhHfV-0003s9-KP for qemu-devel@nongnu.org; Thu, 14 Jul 2011 04:53:13 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6E8rC40026017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Jul 2011 04:53:12 -0400 Date: Thu, 14 Jul 2011 11:52:50 +0300 From: Alon Levy Message-ID: <20110714085250.GE23682@bow.tlv.redhat.com> References: <1310568597-24181-1-git-send-email-alevy@redhat.com> <1310568597-24181-6-git-send-email-alevy@redhat.com> <4E1EAAAE.4060106@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E1EAAAE.4060106@redhat.com> Subject: Re: [Qemu-devel] [PATCHv4 05/11] qxl: add io_port_to_string List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: yhalperi@redhat.com, qemu-devel@nongnu.org On Thu, Jul 14, 2011 at 10:37:02AM +0200, Gerd Hoffmann wrote: > On 07/13/11 16:49, Alon Levy wrote: > >Signed-off-by: Alon Levy > >--- > > hw/qxl.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- > > 1 files changed, 60 insertions(+), 1 deletions(-) > > > >diff --git a/hw/qxl.c b/hw/qxl.c > >index e41f8cc..2ecc932 100644 > >--- a/hw/qxl.c > >+++ b/hw/qxl.c > >@@ -408,6 +408,64 @@ static const char *qxl_mode_to_string(int mode) > > return "INVALID"; > > } > > > >+static const char *io_port_to_string(uint32_t io_port) > >+{ > >+ if (io_port>= QXL_IO_RANGE_SIZE) { > >+ return "out of range"; > >+ } > >+ switch (io_port) { > >+ case QXL_IO_NOTIFY_CMD: > >+ return "QXL_IO_NOTIFY_CMD"; > >+ case QXL_IO_NOTIFY_CURSOR: > >+ return "QXL_IO_NOTIFY_CURSOR"; > > That becomes alot more readable when using a c99 array for it: > > static const char *io_port_names[QXL_IO_RANGE_SIZE] = { > [ QXL_IO_NOTIFY_CMD ] = "notify-cmd", > [ QXL_IO_NOTIFY_CURSOR ] = "notify-cursor", > [ ... ] > }; > > Fine.