Am 04.07.2013 16:38, schrieb Peter Maydell: > On 4 July 2013 14:09, Markus Armbruster <arm...@redhat.com> 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?
It's called the Singleton pattern. :P We use it for the /machine Object, for instance. Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg