[vlc-devel] [PATCH 06/21] input/stream: stream-fragments: add vlc_stream_CreateFragmentMRL

Filip Roséen filip at atch.se
Mon Aug 1 11:18:21 CEST 2016



On 16/08/01 11:06, Denis Charmet wrote:
>     +char* vlc_stream_CreateFragmentedMRL( stream_t* s, char const * fragment )
>     +{
>     +    stream_priv_t *priv = (stream_priv_t*)s;
>     +
>     +    size_t   offset = priv->fragments.offset;
>     +    char**     data = priv->fragments.data;
>     +    char* mrl_cache = data[offset - 1];
>     +
>     +    char* payload;
>     +    char* result;
>     +
>     +    if( PrepareFragment( &payload, fragment, offset ) )
>      You might want to make sure that fragment is not NULL else there will be a segfault in
>      EscapeFragment.

I'd argue that the responsibility to not pass `NULL` as the value for the
relevant parameter lies with the caller, not the underlying implementation.

In my opinion this certainly is one of those functions where passing `NULL`
does not make a lot of sense philosophical speaking, and I am semi-against
adding checks that simply protects something from invalid usage (instead of
explicitly saying that such usage is ill-formed/undefined).

Nonetheless, I'd be happy to sprinkle a few `assert`s related to arguments
passed, and update the documentation to make it more explicit about the
pre-conditions of using this (and other introduced) function(s).

  - Do you think that is a suitable middle ground?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160801/f0f03c61/attachment.html>


More information about the vlc-devel mailing list