[vlc-devel] [PATCH 7/9] vlc_es.h: add es_format_Replace() to explicitly initialize an ES from another ES

Francois Cartegnie fcvlcdev at free.fr
Wed Jul 12 18:08:48 CEST 2017


Le 12/07/2017 à 16:54, Steve Lhomme a écrit :

>  /**
> + * This functions initializes an es_format_t from another es_format_t.
> + *
> + * The destination pointer must be an initialized es_format.
> + */
> +/* VLC_USED for now we're okay with losing strings and extradata */
> +static inline int es_format_Replace( es_format_t *p_dst, const es_format_t *p_src )
> +{
> +    es_format_Clean( p_dst );
> +    return es_format_Copy( p_dst, p_src );
> +}

Again, that's bad abstraction as this is implying no dynamic members
exists, and will need to fix every usage if es_format_t changes again.

Proper cycle is
Clean -> Init -> Copy, even if some steps does nothing internally.

Francois


More information about the vlc-devel mailing list