[vlc-commits] variables: remove useless pf_free/pf_dup for limits
Rémi Denis-Courmont
git at videolan.org
Sat Oct 22 11:14:46 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 22 11:33:13 2016 +0300| [74d595c6b08ffb28e1a444c57259ad2ac86cbaa1] | committer: Rémi Denis-Courmont
variables: remove useless pf_free/pf_dup for limits
Limits are only supported for scalar types.
VLC_VAR_GET_{MIN,MAX,STEP} would not work otherwise anyway.
Thus there is no need to free or duplicate the limit values.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74d595c6b08ffb28e1a444c57259ad2ac86cbaa1
---
src/misc/variables.c | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 1bb6568..ffe5908 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -497,13 +497,9 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
switch( i_action )
{
case VLC_VAR_SETMIN:
- if( p_var->i_type & VLC_VAR_HASMIN )
- {
- p_var->ops->pf_free( &p_var->min );
- }
+ assert(p_var->ops->pf_free == FreeDummy);
p_var->i_type |= VLC_VAR_HASMIN;
p_var->min = *p_val;
- p_var->ops->pf_dup( &p_var->min );
CheckValue( p_var, &p_var->val );
break;
case VLC_VAR_GETMIN:
@@ -513,13 +509,9 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
ret = VLC_EGENERIC;
break;
case VLC_VAR_SETMAX:
- if( p_var->i_type & VLC_VAR_HASMAX )
- {
- p_var->ops->pf_free( &p_var->max );
- }
+ assert(p_var->ops->pf_free == FreeDummy);
p_var->i_type |= VLC_VAR_HASMAX;
p_var->max = *p_val;
- p_var->ops->pf_dup( &p_var->max );
CheckValue( p_var, &p_var->val );
break;
case VLC_VAR_GETMAX:
@@ -529,28 +521,15 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
ret = VLC_EGENERIC;
break;
case VLC_VAR_SETMINMAX:
- if( p_var->i_type & VLC_VAR_HASMIN )
- {
- p_var->ops->pf_free( &p_var->min );
- }
+ assert(p_var->ops->pf_free == FreeDummy);
p_var->i_type |= VLC_VAR_HASMIN;
p_var->min = *p_val;
- p_var->ops->pf_dup( &p_var->min );
-
- if( p_var->i_type & VLC_VAR_HASMAX )
- {
- p_var->ops->pf_free( &p_var->max );
- }
p_var->i_type |= VLC_VAR_HASMAX;
p_var->max = *p_val2;
- p_var->ops->pf_dup( &p_var->max );
-
break;
-
case VLC_VAR_SETSTEP:
- p_var->ops->pf_free( &p_var->step );
+ assert(p_var->ops->pf_free == FreeDummy);
p_var->step = *p_val;
- p_var->ops->pf_dup( &p_var->step );
CheckValue( p_var, &p_var->val );
break;
case VLC_VAR_GETSTEP:
More information about the vlc-commits
mailing list