[vlc-devel] [PATCH] objects: get the vlc_object_t from vlc_object_internals using vlc_internals()

Steve Lhomme robux4 at gmail.com
Tue Jul 25 19:22:19 CEST 2017


On Tue, Jul 25, 2017 at 6:33 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le tiistaina 25. heinäkuuta 2017, 18.06.32 EEST Steve Lhomme a écrit :
>> So that's it coherent with the rest of the usages.
>
> Not really. The other uses operate on an initialized object. Here, we are
> creating and initializing the object.

It's just about accessing the pointer. It doesn't matter what is in
the pointed data.

>> Incidentally I came into this because on some other compilers
>> vlc_internals() returns the position of aligned_end and not the end of the
>> vlc_object_internals structure.
>
> As far as I know, that is actually not possible. The very definition of the

It is possible since I spent hours figuring out why it wasn't working.

> flexible array in ISO C ensures that the two expressions are equivalent. One
> uses byte offsets, and the other direct pointer arithmetic.

If that was equivalent, this wouldn't fail:
static_assert( sizeof(struct vlc_object_internals) !=
             offsetof(struct vlc_object_internals, aligned_end),
             "invalid align_end access");

The first correspond to the +1 I'm trying to change. The second
corresponds to what vlc_internals() does.

In my case vlc_internals() fails to point to the object pointer.

> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list