[vlc-commits] Create a has_key function for a vlc dictionary

Casian Andrei git at videolan.org
Wed Feb 29 07:27:10 CET 2012


vlc | branch: master | Casian Andrei <skeletk13 at gmail.com> | Wed Feb 22 10:27:38 2012 +0200| [308259d1ab249c19463c88b382f705ffde1343e5] | committer: Ilkka Ollakka

Create a has_key function for a vlc dictionary

Signed-off-by: Ilkka Ollakka <ileoo at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=308259d1ab249c19463c88b382f705ffde1343e5
---

 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 )



More information about the vlc-commits mailing list