qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH bugfix v1 3/3] qom: object.h: Update object_get_canon_path* doc
Date: Wed, 20 Aug 2014 10:07:08 +0100	[thread overview]
Message-ID: <CAFEAcA9TF7weiSKSRTyjPkJD9f=pg9nkc7wiQuzJMVuRBNQrfA@mail.gmail.com> (raw)
In-Reply-To: <baefc98b056c326a596cd2f12a4aad97fc4220ed.1408508297.git.peter.crosthwaite@xilinx.com>

On 20 August 2014 06:08, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> With information about return value ownership.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>
>  include/qom/object.h | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/qom/object.h b/include/qom/object.h
> index 8618e49..87de889 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -1029,7 +1029,8 @@ Object *object_get_root(void);
>   * object_get_canonical_path_component:
>   *
>   * Returns: The final component in the object's canonical path.  The canonical
> - * path is the path within the composition tree starting from the root.
> + * path is the path within the composition tree starting from the root. The
> + * returned value may not be modified.
>   */
>  const gchar *object_get_canonical_path_component(Object *obj);

The other thing you need to say is that the returned string is
only valid for as long as the object remains a child property
of its parent. (Is that right? I'm not clear. It also sounds like
a really awkward lifetime management requirement, which
suggests to me that really the "return-a-copy" semantics are
nicer.)

Having object_get_canonical_path_component() and
object_get_canonical_path() having different return value
ownership semantics is likely to be a bit confusing I think.

If we do do this I think I'd put the doc comment change in
the same patch that changes the semantics.

thanks
-- PMM

  reply	other threads:[~2014-08-20  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20  5:06 [Qemu-devel] [PATCH bugfix v1 0/3] Fix Memory Region Name bugs Peter Crosthwaite
2014-08-20  5:07 ` [Qemu-devel] [PATCH bugfix v1 1/3] xen: hvm: Abstract away memory region name ref Peter Crosthwaite
2014-08-20  8:53   ` [Qemu-devel] [PATCH bugfix v1 1/3] xen: hvm: Abstract away memory region name ref (fix broken build) Stefan Weil
2014-08-20  8:55     ` Peter Maydell
2014-08-21 19:27       ` Stefano Stabellini
2014-08-20  5:07 ` [Qemu-devel] [PATCH bugfix v1 2/3] qom: return const for object_get_canon_path component Peter Crosthwaite
2014-08-20  5:08 ` [Qemu-devel] [PATCH bugfix v1 3/3] qom: object.h: Update object_get_canon_path* doc Peter Crosthwaite
2014-08-20  9:07   ` Peter Maydell [this message]
2014-08-20 14:54     ` Peter Crosthwaite
2014-08-20 15:58     ` Paolo Bonzini
2014-08-21  3:10       ` Peter Crosthwaite

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='CAFEAcA9TF7weiSKSRTyjPkJD9f=pg9nkc7wiQuzJMVuRBNQrfA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --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).