Commit fc43e13f authored by Rémi Duraffort's avatar Rémi Duraffort

variables:

 * print a warning when var_DelCallback can't find the callback because the
   data doesn't match
 * these warning are only for debug builds.
parent 81d38c62
...@@ -835,9 +835,11 @@ int var_GetChecked( vlc_object_t *p_this, const char *psz_name, ...@@ -835,9 +835,11 @@ int var_GetChecked( vlc_object_t *p_this, const char *psz_name,
/* Really get the variable */ /* Really get the variable */
*p_val = p_var->val; *p_val = p_var->val;
#ifndef NDEBUG
/* Alert if the type is VLC_VAR_VOID */ /* Alert if the type is VLC_VAR_VOID */
if( ( p_var->i_type & VLC_VAR_TYPE ) == VLC_VAR_VOID ) if( ( p_var->i_type & VLC_VAR_TYPE ) == VLC_VAR_VOID )
msg_Warn( p_this, "Calling var_GetVoid on the void variable '%s' (0x%04x)", psz_name, p_var->i_type ); msg_Warn( p_this, "Calling var_GetVoid on the void variable '%s' (0x%04x)", psz_name, p_var->i_type );
#endif
/* Duplicate value if needed */ /* Duplicate value if needed */
p_var->ops->pf_dup( p_val ); p_var->ops->pf_dup( p_val );
...@@ -941,6 +943,13 @@ int __var_DelCallback( vlc_object_t *p_this, const char *psz_name, ...@@ -941,6 +943,13 @@ int __var_DelCallback( vlc_object_t *p_this, const char *psz_name,
{ {
break; break;
} }
#ifndef NDEBUG
else if( p_var->p_entries[i_entry].pf_callback == pf_callback )
{
msg_Warn( p_this, "Calling var_DelCallback for '%s' with the same "
"function but not the same data.", psz_name );
}
#endif
} }
if( i_entry < 0 ) if( i_entry < 0 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment