From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LL25P-00047v-JG for qemu-devel@nongnu.org; Thu, 08 Jan 2009 16:06:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LL25N-00047G-0n for qemu-devel@nongnu.org; Thu, 08 Jan 2009 16:06:38 -0500 Received: from [199.232.76.173] (port=38766 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LL25M-00047A-JC for qemu-devel@nongnu.org; Thu, 08 Jan 2009 16:06:36 -0500 Received: from mail-ew0-f21.google.com ([209.85.219.21]:46266) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LL25M-0008NV-46 for qemu-devel@nongnu.org; Thu, 08 Jan 2009 16:06:36 -0500 Received: by ewy14 with SMTP id 14so10432210ewy.10 for ; Thu, 08 Jan 2009 13:06:34 -0800 (PST) Message-ID: <49666AD2.80001@codemonkey.ws> Date: Thu, 08 Jan 2009 15:06:26 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1 of 3] Fix keymap handling for vnc console References: <4947CA2B.5030401@oracle.com> <4947CD50.8040806@oracle.com> <496661C6.3010507@codemonkey.ws> <49666636.30801@oracle.com> In-Reply-To: <49666636.30801@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org John Haxby wrote: > The size of the array is dramatically larger than it used to be -- > over 1000 entries -- so a linear search over about 200 keysyms is, I > thought, a little excessive for linear search and would take an > appreciable time at start up. It also seems to me that more keysyms > might need to be added in future: the choice was a one-off sort in the > vnc_keysym.h definition which is prone to future editing errors or the > one-off static sort in the code. I tossed the arguments back and > forth with my stuffed penguin and came down in favour of sorting the > array: it's a technique I've used before when I wanted robust code at > the expense of a little initialisation overhead. Why do you think > it's not a good idea? I'll happily revisit the notion. Since it's a literal array, it's sort of weird to sort it at run time. Why not just pre-sort it in the code? Heck, just write a simple program to re-output the array even in a sorted form. If you did that, the binary search thing would be fine. It's the sorting of the literal array that makes me nervous. Regards, Anthony Liguori > > I have no idea why the indenting is screwed up -- it wasn't. I think > the Christmas Elves must've got at it. > > Read and understood the remainder of the comments. I'll re-submit > the patches tomorrow -- thanks for looking. > > jch > > >