[FFmpeg-devel] [PATCH 1/4] av_dict_set: add fag to allow NULL values
Michael Niedermayer
michaelni at gmx.at
Sun Jul 21 13:33:15 CEST 2013
On Sun, Jul 21, 2013 at 01:09:49PM +0200, Stefano Sabatini wrote:
> What about:
> lavu/dict: add flags to allow NULL values for av_dict_set()
>
> On date Saturday 2013-07-20 18:55:02 +0200, Michael Niedermayer encoded:
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> > libavutil/dict.c | 2 +-
> > libavutil/dict.h | 2 ++
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavutil/dict.c b/libavutil/dict.c
> > index 3a0e84c..f965492 100644
> > --- a/libavutil/dict.c
> > +++ b/libavutil/dict.c
> > @@ -84,7 +84,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags
> > } else
> > return AVERROR(ENOMEM);
> > }
> > - if (value) {
> > + if (value || (flags & AV_DICT_ALLOW_NULLVAL)) {
> > if (flags & AV_DICT_DONT_STRDUP_KEY) {
> > m->elems[m->count].key = (char*)(intptr_t)key;
> > } else
> > diff --git a/libavutil/dict.h b/libavutil/dict.h
> > index 38f03a4..944d932 100644
> > --- a/libavutil/dict.h
> > +++ b/libavutil/dict.h
> > @@ -74,6 +74,8 @@
> > #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
> > delimiter is added, the strings are simply concatenated. */
> >
> > +#define AV_DICT_ALLOW_NULLVAL 65536 /**< Allow keys without value */
>
> _NULL_VAL?
>
> Also, what happens in case the value is NULL?
you store a dictonary entry with value NULL
[....]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130721/87cf5cb8/attachment.asc>
More information about the ffmpeg-devel
mailing list