qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] Revised: Add object_property_get_child().


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2] Revised: Add object_property_get_child().
Date: Sun, 19 Feb 2012 18:30:36 +0000

On 19 February 2012 17:14, Andreas Färber <address@hidden> wrote:
> Am 19.02.2012 17:04, schrieb Alexander Barabash:
>> +    return g_strndup(&type[sizeof(LINK_PROPERTY_TYPE_PREFIX) - 1],
>> +                     strlen(type)
>> +                     - (sizeof(LINK_PROPERTY_TYPE_PREFIX) - 1)
>> +                     - (sizeof(LINK_PROPERTY_TYPE_SUFFIX) - 1));
>
> Any reason not to use strlen()? I don't think this is a hot path, and
> repeated sizeof() - 1 does not read so nice.

gcc will optimise away strlen("constant string") at compile time anyway,
so there really is no need to avoid it.

-- PMM



reply via email to

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