From: "Andreas Färber" <afaerber@suse.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
Anthony Liguori <anthony@codemonkey.ws>,
agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 01/10] qom: Make object_resolve_path_component() path argument const
Date: Mon, 14 Jan 2013 17:52:21 +0100 [thread overview]
Message-ID: <50F437C5.4020905@suse.de> (raw)
In-Reply-To: <87k3rg2bzf.fsf@blackfin.pond.sub.org>
Am 14.01.2013 13:19, schrieb Markus Armbruster:
> Andreas Färber <afaerber@suse.de> writes:
>
>> This allows to navigate partial well-known paths from an object.
>
> Why does making the argument const allow such navigation?
Without const, object_resolve_path_component(foo, "bar") results in a
compile error (09/10 accesses "ide[1]" etc. to avoid exposing the full
MacIOState).
Apparently this function was so far only used on dynamically generated
(non-const) arrays:
qom/container.c: child = object_resolve_path_component(obj,
parts[i]);
qom/object.c: child = object_resolve_path_component(parent,
parts[index]);
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> Cc: Anthony Liguori <anthony@codemonkey.ws>
>> ---
>> include/qom/object.h | 2 +-
>> qom/object.c | 2 +-
>> 2 Dateien geändert, 2 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
>>
>> diff --git a/include/qom/object.h b/include/qom/object.h
>> index d43b289..1ef2f0e 100644
>> --- a/include/qom/object.h
>> +++ b/include/qom/object.h
>> @@ -900,7 +900,7 @@ Object *object_resolve_path_type(const char *path, const char *typename,
>> *
>> * Returns: The resolved object or NULL on path lookup failure.
>> */
>> -Object *object_resolve_path_component(Object *parent, gchar *part);
>> +Object *object_resolve_path_component(Object *parent, const gchar *part);
>> /**
>> * object_property_add_child:
>> diff --git a/qom/object.c b/qom/object.c
>> index 351b88c..03e6f24 100644
>> --- a/qom/object.c
>> +++ b/qom/object.c
>> @@ -1017,7 +1017,7 @@ gchar *object_get_canonical_path(Object *obj)
>> return newpath;
>> }
>>
>> -Object *object_resolve_path_component(Object *parent, gchar *part)
>> +Object *object_resolve_path_component(Object *parent, const gchar *part)
>> {
>> ObjectProperty *prop = object_property_find(parent, part, NULL);
>> if (prop == NULL) {
>
> Unrelated: do we really want to go along with glib's basic type typedef
> silliness?
Elsewhere I have adopted the exact GLib signature since typedefs can be
changed at any time. In particular the GCompareFunc using gconstpointer,
gint, etc. Not saying I find their GLib usage useful.
I admit I didn't review object_property_find(), which uses const char*.
So I wouldn't mind sending a v2 if non-g is preferred. Or Anthony or
Stefan could just edit the patch in my name before applying. :)
Andreas
--
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-01-14 16:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-13 23:54 [Qemu-devel] [RFC ppc-next v3 00/10] target-ppc: MacIO QOM'ification Andreas Färber
2013-01-13 23:54 ` [Qemu-devel] [PATCH 01/10] qom: Make object_resolve_path_component() path argument const Andreas Färber
2013-01-14 12:19 ` Markus Armbruster
2013-01-14 16:52 ` Andreas Färber [this message]
2013-01-14 17:27 ` Markus Armbruster
2013-01-14 19:01 ` [Qemu-devel] Go along with glib's basic type typedef silliness? (was: [PATCH 01/10] qom: Make object_resolve_path_component() path argument const) Markus Armbruster
2013-01-17 20:26 ` Blue Swirl
2013-01-18 15:36 ` [Qemu-devel] Go along with glib's basic type typedef silliness? Markus Armbruster
2013-01-19 9:13 ` Blue Swirl
2013-01-13 23:54 ` [Qemu-devel] [RFC ppc-next v3 02/10] ppc: Move Mac machines to hw/ppc/ Andreas Färber
2013-01-13 23:54 ` [Qemu-devel] [RFC ppc-next v3 03/10] macio: QOM'ify some more Andreas Färber
2013-01-13 23:54 ` [Qemu-devel] [RFC ppc-next v3 04/10] macio: Delay qdev init until all fields are initialized Andreas Färber
2013-01-13 23:54 ` [Qemu-devel] [RFC ppc-next v3 05/10] macio: Split MacIO in two Andreas Färber
2013-01-13 23:55 ` [Qemu-devel] [RFC ppc-next v3 06/10] mac_nvram: Clean up public API Andreas Färber
2013-01-13 23:55 ` [Qemu-devel] [RFC ppc-next v3 07/10] mac_nvram: Mark as Big Endian Andreas Färber
2013-01-13 23:55 ` [Qemu-devel] [RFC ppc-next v3 08/10] mac_nvram: QOM'ify MacIO NVRAM Andreas Färber
2013-01-14 12:34 ` Markus Armbruster
2013-01-14 16:22 ` Andreas Färber
2013-01-14 17:30 ` Markus Armbruster
2013-01-13 23:55 ` [Qemu-devel] [RFC ppc-next v3 09/10] ide/macio: QOM'ify MacIO IDE Andreas Färber
2013-01-13 23:55 ` [Qemu-devel] [RFC ppc-next v3 10/10] cuda: QOM'ify CUDA Andreas Färber
2013-01-14 12:47 ` [Qemu-devel] [RFC ppc-next v3 00/10] target-ppc: MacIO QOM'ification Markus Armbruster
2013-01-14 21:56 ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
2013-01-18 16:36 ` Andreas Färber
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=50F437C5.4020905@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-trivial@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).