From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH v6 1/2] qom: Detect attempts to add a property that already exists
Date: Mon, 18 Mar 2013 15:39:48 +0100 [thread overview]
Message-ID: <51472734.50401@suse.de> (raw)
In-Reply-To: <1363451962-25952-2-git-send-email-peter.maydell@linaro.org>
Am 16.03.2013 17:39, schrieb Peter Maydell:
> Detect attempts to add a property to an object if one of
> that name already exists, and report them as errors.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
> qom/object.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index 3d638ff..875315a 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -629,7 +629,18 @@ void object_property_add(Object *obj, const char *name, const char *type,
> ObjectPropertyRelease *release,
> void *opaque, Error **errp)
> {
> - ObjectProperty *prop = g_malloc0(sizeof(*prop));
> + ObjectProperty *prop;
> +
> + QTAILQ_FOREACH(prop, &obj->properties, node) {
> + if (strcmp(prop->name, name) == 0) {
> + error_setg(errp, "attempt to add duplicate property '%s'"
> + " to object (type '%s')\n", name,
No \n in error_setg(), there was a recent cleanup series.
Andreas
> + object_get_typename(obj));
> + return;
> + }
> + }
> +
> + prop = g_malloc0(sizeof(*prop));
>
> prop->name = g_strdup(name);
> prop->type = g_strdup(type);
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-03-18 14:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 16:39 [Qemu-devel] [PATCH v6 0/2] qdev: Detect duplicate device properties Peter Maydell
2013-03-16 16:39 ` [Qemu-devel] [PATCH v6 1/2] qom: Detect attempts to add a property that already exists Peter Maydell
2013-03-18 14:39 ` Andreas Färber [this message]
2013-03-16 16:39 ` [Qemu-devel] [PATCH v6 2/2] hw/qdev: Abort rather than ignoring errors adding device properties Peter Maydell
2013-03-18 12:41 ` [Qemu-devel] [PATCH v6 0/2] qdev: Detect duplicate " Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51472734.50401@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).