mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-08 21:33:57 +00:00
[common] option: add debug errors for invalid options
This commit is contained in:
parent
a29639fceb
commit
db0d966102
2 changed files with 10 additions and 1 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
a12-198-g0605b7df8c+1
|
||||
a12-199-ga29639fceb+1
|
|
@ -684,7 +684,10 @@ int option_get_int(const char * module, const char * name)
|
|||
{
|
||||
struct Option * o = option_get(module, name);
|
||||
if (!o)
|
||||
{
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return -1;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_INT);
|
||||
return o->value.x_int;
|
||||
}
|
||||
|
@ -693,7 +696,10 @@ const char * option_get_string(const char * module, const char * name)
|
|||
{
|
||||
struct Option * o = option_get(module, name);
|
||||
if (!o)
|
||||
{
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return NULL;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_STRING);
|
||||
return o->value.x_string;
|
||||
}
|
||||
|
@ -702,7 +708,10 @@ bool option_get_bool(const char * module, const char * name)
|
|||
{
|
||||
struct Option * o = option_get(module, name);
|
||||
if (!o)
|
||||
{
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return false;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_BOOL);
|
||||
return o->value.x_bool;
|
||||
}
|
Loading…
Reference in a new issue