Commit 6d0a8b7b authored by Daan Vreeken's avatar Daan Vreeken
Browse files

Also add the optional initial value argument to 'value_bool' and 'value_uint32'.

My .ctrl file is so much cleaner this way :)

	modified:   block/block_value_bool.c
	modified:   block/block_value_uint32.c
parent ca041574
......@@ -56,7 +56,8 @@ static struct controller_block_outterm_list outterms[] = {
{ NULL }
};
static struct controller_block * block_value_bool_create(char *name, int argc, va_list val)
static struct controller_block * block_value_bool_create(char *name, int argc,
va_list val)
{
struct controller_block *value;
......@@ -64,7 +65,10 @@ static struct controller_block * block_value_bool_create(char *name, int argc, v
if (!value)
return NULL;
value->private->value = 0.0;
if (argc == 0)
value->private->value = 0.0;
else
value->private->value = va_arg(val, int);
if (controller_block_outterm_list_init(value, outterms))
goto err_block;
......@@ -85,5 +89,5 @@ err_block:
BLOCK_CREATE(value_bool) = {
.create = block_value_bool_create,
.args = { NULL },
.args = { "", "int", NULL },
};
......@@ -57,14 +57,18 @@ static struct controller_block_outterm_list outterms[] = {
{ NULL }
};
static struct controller_block * block_value_uint32_create(char *name, int argc, va_list val)
static struct controller_block * block_value_uint32_create(char *name,
int argc, va_list val)
{
struct controller_block *value;
if (!(value = controller_block_alloc("value_uint32", name, sizeof(struct controller_block_private))))
return NULL;
value->private->value = 0.0;
if (argc == 0)
value->private->value = 0.0;
else
value->private->value = va_arg(val, int);
if (controller_block_outterm_list_init(value, outterms))
goto err_block;
......@@ -85,6 +89,6 @@ err_block:
BLOCK_CREATE(value_uint32) = {
.create = block_value_uint32_create,
.args = { NULL },
.args = { "", "int", NULL },
};
Supports Markdown
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