qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC for-2.7 01/11] qdt: IEEE1275-style device tree uti


From: David Gibson
Subject: Re: [Qemu-devel] [RFC for-2.7 01/11] qdt: IEEE1275-style device tree utility code
Date: Thu, 28 Apr 2016 09:49:39 +1000
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Apr 27, 2016 at 09:28:57AM +0200, Markus Armbruster wrote:
> Thomas Huth <address@hidden> writes:
> 
> > On 27.04.2016 08:43, Markus Armbruster wrote:
> >> David Gibson <address@hidden> writes:
> >> 
> >>> On Tue, Apr 26, 2016 at 01:00:06PM +0200, Thomas Huth wrote:
> >>>> On 20.04.2016 04:33, David Gibson wrote:
> > [...]
> >>>>> +/*
> >>>>> + * Property functions
> >>>>> + */
> >>>>> +
> >>>>> +QDTProperty *qdt_new_property(const gchar *name, gconstpointer val, 
> >>>>> gsize len)
> >>>>> +{
> >>>>> +    QDTProperty *prop = g_malloc0(sizeof(*prop) + len);
> >>>>> +
> >>>>> +    prop->name = g_strdup(name);
> >>>>> +    prop->len = len;
> >>>>> +    memcpy(prop->val, val, len);
> >>>>> +    return prop;
> >>>>> +}
> >>>>> +
> >>>>> +static QDTProperty *getprop_(const QDTNode *node, const gchar *name)
> >>>>
> >>>> Underscore at the end looks somewhat strange ... can't you simply drop 
> >>>> that?
> >>>
> >>> Well.. the idea was that the _ versions are the "internal" ones,
> >>> whereas external users will generally use the non-underscore version
> >> 
> >> I've seen that convention used before.  It's fine with me.
> >
> > Can't remember to have seen that convention before ... I know that some
> > people use the underscore at the beginning to mark an internal function,
> > but at the end?
> > So if you really want to use the underscore, what about putting it at
> > the beginning instead?
> 
> C99 7.1.3  Reserved identifiers:
> 
>          -- All identifiers  that  begin  with  an  underscore  are
>             always  reserved for use as identifiers with file scope
>             in both the ordinary and tag name spaces.

Right.  The kernel uses the _ prefix convention, but it can kind of
get away with it, because it doesn't use the standard library.  For
things in userspace, _ prefixed identifiers are reserved, hence using
the _ suffix instead.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

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