From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCAFs-0000ZY-Es for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:46:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCAFj-0003US-BF for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:46:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCAFj-0003U5-3H for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:46:31 -0400 Message-ID: <4F707333.7070804@redhat.com> Date: Mon, 26 Mar 2012 15:46:27 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1332766053-9063-1-git-send-email-alevy@redhat.com> <1332766053-9063-3-git-send-email-alevy@redhat.com> <4F7069CE.5040905@redhat.com> <20120326133049.GD32389@garlic> In-Reply-To: <20120326133049.GD32389@garlic> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spice_info: add mouse_mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: spice-devel@freedesktop.org, qemu-devel@nongnu.org On 03/26/12 15:30, Alon Levy wrote: > On Mon, Mar 26, 2012 at 03:06:22PM +0200, Gerd Hoffmann wrote: >>> +#if SPICE_SERVER_VERSION >= 0x000a03 /* 0.10.3 */ >>> + info->has_mouse_mode = true; >>> + info->mouse_mode = g_strdup(spice_server_is_server_mouse(spice_server) ? >>> + "server" : "client"); >> >> #else >> info->mouse_mode = "unknown"; >> #endif > > Why? has_mouse_mode looks superfluous and makes the code a bit more complicated than needed. > I don't set has_mouse_mode in this case, which defaults to 0 == > false because of the malloc0, and then I check has_mouse_mode in the hmp > command, and the qmp just won't send the field because has == false. Ah, ok, didn't see qmp does something different, then I'd suggest to just leave mouse_mode zero-initialized (aka NULL) when mouse mode info isn't available. cheers, Gerd