Commit 57b33866 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Simplify

parent 4b456708
...@@ -116,24 +116,31 @@ girara_setting_get_value(girara_setting_t* setting, void* dest) ...@@ -116,24 +116,31 @@ girara_setting_get_value(girara_setting_t* setting, void* dest)
{ {
g_return_val_if_fail(setting != NULL && dest != NULL, false); g_return_val_if_fail(setting != NULL && dest != NULL, false);
bool *bvalue = (bool*) dest;
float *fvalue = (float*) dest;
int *ivalue = (int*) dest;
char **svalue = (char**) dest;
switch(setting->type) { switch(setting->type) {
case BOOLEAN: case BOOLEAN:
{
bool *bvalue = (bool *)dest;
*bvalue = setting->value.b; *bvalue = setting->value.b;
break; break;
}
case FLOAT: case FLOAT:
{
float *fvalue = (float *)dest;
*fvalue = setting->value.f; *fvalue = setting->value.f;
break; break;
}
case INT: case INT:
{
int *ivalue = (int*) dest;
*ivalue = setting->value.i; *ivalue = setting->value.i;
break; break;
}
case STRING: case STRING:
{
char **svalue = (char**) dest;
*svalue = setting->value.s ? g_strdup(setting->value.s) : NULL; *svalue = setting->value.s ? g_strdup(setting->value.s) : NULL;
break; break;
}
default: default:
g_assert(false); g_assert(false);
} }
......
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