[vlc-commits] config: assert item type matching
Rémi Denis-Courmont
git at videolan.org
Tue Jul 25 18:15:10 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 25 18:56:25 2017 +0300| [ceb6425eaf81ee17b102312c3a773562d55b363e] | committer: Rémi Denis-Courmont
config: assert item type matching
This is consistent with variables handling, as well as config choices.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ceb6425eaf81ee17b102312c3a773562d55b363e
---
src/config/core.c | 38 +++++++-------------------------------
1 file changed, 7 insertions(+), 31 deletions(-)
diff --git a/src/config/core.c b/src/config/core.c
index 296cc37a00..88f2a5fb05 100644
--- a/src/config/core.c
+++ b/src/config/core.c
@@ -101,11 +101,7 @@ int64_t config_GetInt( vlc_object_t *p_this, const char *psz_name )
return -1;
}
- if (!IsConfigIntegerType (p_config->i_type))
- {
- msg_Err( p_this, "option %s does not refer to an int", psz_name );
- return -1;
- }
+ assert(IsConfigIntegerType(p_config->i_type));
int64_t val;
@@ -135,11 +131,7 @@ float config_GetFloat( vlc_object_t *p_this, const char *psz_name )
return -1;
}
- if (!IsConfigFloatType (p_config->i_type))
- {
- msg_Err( p_this, "option %s does not refer to a float", psz_name );
- return -1;
- }
+ assert(IsConfigFloatType(p_config->i_type));
float val;
@@ -174,11 +166,7 @@ char * config_GetPsz( vlc_object_t *p_this, const char *psz_name )
return NULL;
}
- if (!IsConfigStringType (p_config->i_type))
- {
- msg_Err( p_this, "option %s does not refer to a string", psz_name );
- return NULL;
- }
+ assert(IsConfigStringType (p_config->i_type));
/* return a copy of the string */
vlc_rwlock_rdlock (&config_lock);
@@ -209,11 +197,7 @@ void config_PutPsz( vlc_object_t *p_this,
return;
}
- if (!IsConfigStringType (p_config->i_type))
- {
- msg_Err( p_this, "option %s does not refer to a string", psz_name );
- return;
- }
+ assert(IsConfigStringType(p_config->i_type));
char *str, *oldstr;
if ((psz_value != NULL) && *psz_value)
@@ -250,11 +234,7 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
return;
}
- if (!IsConfigIntegerType (p_config->i_type))
- {
- msg_Err( p_this, "option %s does not refer to an int", psz_name );
- return;
- }
+ assert(IsConfigIntegerType(p_config->i_type));
if (i_value < p_config->min.i)
i_value = p_config->min.i;
@@ -286,14 +266,10 @@ void config_PutFloat( vlc_object_t *p_this,
return;
}
- if (!IsConfigFloatType (p_config->i_type))
- {
- msg_Err( p_this, "option %s does not refer to a float", psz_name );
- return;
- }
+ assert(IsConfigFloatType(p_config->i_type));
/* if f_min == f_max == 0, then do not use them */
- if ((p_config->min.f == 0) && (p_config->max.f == 0))
+ if ((p_config->min.f == 0.f) && (p_config->max.f == 0.f))
;
else if (f_value < p_config->min.f)
f_value = p_config->min.f;
More information about the vlc-commits
mailing list