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

Casian Andrei git at videolan.org
Mon Mar 5 19:21:18 CET 2012


vlc/vlc-2.0 | branch: master | Casian Andrei <skeletk13 at gmail.com> | Wed Feb 22 10:27:38 2012 +0200| [7e9873e9008cf1d91af6c47d84d73981129f59ff] | committer: Jean-Baptiste Kempf

Create a has_key function for a vlc dictionary

Signed-off-by: Ilkka Ollakka <ileoo at videolan.org>
(cherry picked from commit 308259d1ab249c19463c88b382f705ffde1343e5)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=7e9873e9008cf1d91af6c47d84d73981129f59ff
---

 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