From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulF0-0008If-75 for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:14:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UulEz-0004uk-99 for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:14:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50458 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UulEz-0004ub-0i for qemu-devel@nongnu.org; Thu, 04 Jul 2013 11:14:37 -0400 Message-ID: <51D59158.20602@suse.de> Date: Thu, 04 Jul 2013 17:14:32 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1372943363-24081-1-git-send-email-armbru@redhat.com> <1372943363-24081-4-git-send-email-armbru@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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, Markus Armbruster , qemu-devel@nongnu.org Am 04.07.2013 16:38, schrieb Peter Maydell: > 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 =3D qemu_find_opts("machine"); >> + assert(list); >> + opts =3D qemu_opts_find(list, NULL); >> + if (!opts) { >> + opts =3D qemu_opts_create_nofail(list); >> + } >> + return opts; >> +} >=20 > This looks a bit odd -- why are we creating new > options in a function that claims to only be querying > them? It's called the Singleton pattern. :P We use it for the /machine Object, for instance. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg