qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 01/10] qom: Make object_resolve_path_component()


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 01/10] qom: Make object_resolve_path_component() path argument const
Date: Mon, 14 Jan 2013 18:27:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Andreas Färber <address@hidden> writes:

> Am 14.01.2013 13:19, schrieb Markus Armbruster:
>> Andreas Färber <address@hidden> 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]);

Makes sense, but isn't immediately obvious from your commit message.
What about:

    qom: Make object_resolve_path_component() path argument const

    Navigating well-known paths from an object like

        object_resolve_path_component(foo, "bar")

    is perfectly legitimate, but doesn't compile, because the second
    parameter lacks const.  Fix that.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]