[vlc-devel] [PATCH] dbus: Prevent dictionary from growing out of control

Ilkka Ollakka ileoo at videolan.org
Wed Feb 29 07:27:34 CET 2012


On Wed, Feb 22, 2012 at 10:33:23AM +0200, Casian Andrei wrote:
> Sure. Attached the two patches.

Thanks for the patches, both applied

> 2012/2/22 Jean-Baptiste Kempf <jb at videolan.org>

> > On Tue, Feb 21, 2012 at 09:40:23PM +0200, Casian Andrei wrote :
> > >  include/vlc_arrays.h        |    8 ++++++++

> > >  modules/control/dbus/dbus.c |    3 ++-

> > Can you split the patch in 2, please?

> > Best regards,

> > --
> > Jean-Baptiste Kempf
> > http://www.jbkempf.com/ - +33 672 704 734
> > Sent from my Electronic Device
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > http://mailman.videolan.org/listinfo/vlc-devel


> From fd026addc5765e82c122969635c545d674eaf244 Mon Sep 17 00:00:00 2001
> From: Casian Andrei <skeletk13 at gmail.com>
> Date: Wed, 22 Feb 2012 10:27:38 +0200
> Subject: [PATCH 1/2] Create a has_key function for a vlc dictionary

> ---
>  include/vlc_arrays.h |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)

> diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
> index 68ea1e2..6643197 100644
> --- a/include/vlc_arrays.h
> +++ b/include/vlc_arrays.h
> @@ -451,7 +451,15 @@ static inline void vlc_dictionary_clear( vlc_dictionary_t * p_dict,
>      p_dict->i_size = 0;
>  }

> +static inline int
> +vlc_dictionary_has_key( const vlc_dictionary_t * p_dict, const char * psz_key )
> +{
> +    if( !p_dict->p_entries )
> +        return 0;

> +    int i_pos = DictHash( psz_key, p_dict->i_size );
> +    return p_dict->p_entries[i_pos] != NULL;
> +}

>  static inline void *
>  vlc_dictionary_value_for_key( const vlc_dictionary_t * p_dict, const char * psz_key )
-- 
Ilkka Ollakka
Don't let people drive you crazy when you know it's in walking
distance.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120229/fc56f7ba/attachment.sig>


More information about the vlc-devel mailing list