From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uul42-0001Y3-9V for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:03:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uul3x-0000vC-Hl for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:03:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uul3x-0000ut-AI for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:03:13 -0400 From: Markus Armbruster References: <1372943363-24081-1-git-send-email-armbru@redhat.com> <1372943363-24081-4-git-send-email-armbru@redhat.com> Date: Thu, 04 Jul 2013 17:03:10 +0200 In-Reply-To: (Peter Maydell's message of "Thu, 4 Jul 2013 15:38:37 +0100") Message-ID: <87fvvuz7td.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 3/7] vl: New qemu_get_machine_opts() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Peter Maydell writes: > On 4 July 2013 14:09, Markus Armbruster wrote: >> >> +/** >> + * Get machine options >> + * >> + * Returns: machine options (never null). >> + */ >> +QemuOpts *qemu_get_machine_opts(void) >> +{ >> + QemuOptsList *list; >> + QemuOpts *opts; >> + >> + list = qemu_find_opts("machine"); >> + assert(list); >> + opts = qemu_opts_find(list, NULL); >> + if (!opts) { >> + opts = qemu_opts_create_nofail(list); >> + } >> + return opts; >> +} > > This looks a bit odd -- why are we creating new > options in a function that claims to only be querying > them? So we never return null. If it bothers you, I can initialize the options to empty somewhere else, and assert they exist here.