]> git.sesse.net Git - vlc/commitdiff
Some old stats fixes
authorClément Stenac <zorglub@videolan.org>
Sat, 29 Jul 2006 13:31:32 +0000 (13:31 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 29 Jul 2006 13:31:32 +0000 (13:31 +0000)
include/vlc_messages.h
src/misc/stats.c

index 7b9e7d6227b3f9bb1b5a3912a07d66a5e3a72f36..d719d15b9c8257b627ff02910aac6505f14a3db2 100644 (file)
@@ -281,6 +281,7 @@ static inline int __stats_GetInteger( vlc_object_t *p_obj, counter_t *p_counter,
 {
     int i_ret;
     vlc_value_t val; val.i_int = 0;
+    if( !p_counter ) return VLC_EGENERIC;
     i_ret = __stats_Get( p_obj, p_counter, &val );
     *value = val.i_int;
     return i_ret;
@@ -292,6 +293,7 @@ static inline int __stats_GetFloat( vlc_object_t *p_obj, counter_t *p_counter,
 {
     int i_ret;
     vlc_value_t val; val.f_float = 0.0;
+    if( !p_counter ) return VLC_EGENERIC;
     i_ret = __stats_Get( p_obj, p_counter, &val );
     *value = val.f_float;
     return i_ret;
@@ -303,6 +305,7 @@ static inline int __stats_UpdateInteger( vlc_object_t *p_obj,counter_t *p_co,
     int i_ret;
     vlc_value_t val;
     vlc_value_t new_val; new_val.i_int = 0;
+    if( !p_co ) return VLC_EGENERIC;
     val.i_int = i;
     i_ret = __stats_Update( p_obj, p_co, val, &new_val );
     if( pi_new )
@@ -316,6 +319,7 @@ static inline int __stats_UpdateFloat( vlc_object_t *p_obj, counter_t *p_co,
     vlc_value_t val;
     int i_ret;
     vlc_value_t new_val;new_val.f_float = 0.0;
+    if( !p_co ) return VLC_EGENERIC;
     val.f_float = f;
     i_ret =  __stats_Update( p_obj, p_co, val, &new_val );
     if( pf_new )
index e6a273573e84a98361c3cbb743060e651c34eb71..d4f0beae06c96db4b3eb20c8c5229a0fff3bd88a 100644 (file)
@@ -54,10 +54,7 @@ static void TimerDump( vlc_object_t *p_this, counter_t *p_counter, vlc_bool_t);
 counter_t * __stats_CounterCreate( vlc_object_t *p_this,
                                    int i_type, int i_compute_type )
 {
-    counter_t *p_counter;
-    if( !p_this->p_libvlc->b_stats ) return NULL;
-
-    p_counter = (counter_t*) malloc( sizeof( counter_t ) ) ;
+    counter_t *p_counter = (counter_t*) malloc( sizeof( counter_t ) ) ;
 
     p_counter->i_compute_type = i_compute_type;
     p_counter->i_type = i_type;