mirror of
https://github.com/lbonn/rofi
synced 2024-11-26 13:50:27 +00:00
xrmoptions: Use a switch where possible
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
parent
ae4ea622bb
commit
58ed481198
1 changed files with 18 additions and 12 deletions
|
@ -226,11 +226,14 @@ void config_parser_add_option ( XrmOptionType type, const char *key, void **valu
|
|||
extra_options[num_extra_options].value.pointer = value;
|
||||
extra_options[num_extra_options].comment = comment;
|
||||
extra_options[num_extra_options].source = CONFIG_DEFAULT;
|
||||
if ( type == xrm_String ) {
|
||||
switch ( type )
|
||||
{
|
||||
case xrm_String:
|
||||
extra_options[num_extra_options].mem = ( (char *) ( *value ) );
|
||||
}
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
extra_options[num_extra_options].mem = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
num_extra_options++;
|
||||
|
@ -238,7 +241,9 @@ void config_parser_add_option ( XrmOptionType type, const char *key, void **valu
|
|||
|
||||
static void config_parser_set ( XrmOption *option, char *xrmValue, enum ConfigSource source )
|
||||
{
|
||||
if ( option->type == xrm_String ) {
|
||||
switch ( option->type )
|
||||
{
|
||||
case xrm_String:
|
||||
if ( ( option )->mem != NULL ) {
|
||||
g_free ( option->mem );
|
||||
option->mem = NULL;
|
||||
|
@ -247,14 +252,14 @@ static void config_parser_set ( XrmOption *option, char *xrmValue, enum ConfigSo
|
|||
|
||||
// Memory
|
||||
( option )->mem = *( option->value.str );
|
||||
}
|
||||
else if ( option->type == xrm_Number ) {
|
||||
break;
|
||||
case xrm_Number:
|
||||
*( option->value.num ) = (unsigned int) g_ascii_strtoull ( xrmValue, NULL, 10 );
|
||||
}
|
||||
else if ( option->type == xrm_SNumber ) {
|
||||
break;
|
||||
case xrm_SNumber:
|
||||
*( option->value.snum ) = (int) g_ascii_strtoll ( xrmValue, NULL, 10 );
|
||||
}
|
||||
else if ( option->type == xrm_Boolean ) {
|
||||
break;
|
||||
case xrm_Boolean:
|
||||
if ( strlen ( xrmValue ) > 0 &&
|
||||
g_ascii_strcasecmp ( xrmValue, "true" ) == 0 ) {
|
||||
*( option->value.num ) = TRUE;
|
||||
|
@ -262,9 +267,10 @@ static void config_parser_set ( XrmOption *option, char *xrmValue, enum ConfigSo
|
|||
else{
|
||||
*( option->value.num ) = FALSE;
|
||||
}
|
||||
}
|
||||
else if ( option->type == xrm_Char ) {
|
||||
break;
|
||||
case xrm_Char:
|
||||
*( option->value.charc ) = helper_parse_char ( xrmValue );
|
||||
break;
|
||||
}
|
||||
option->source = source;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue