summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stage.c12
-rw-r--r--src/stage.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/stage.c b/src/stage.c
index 4d18486..13519b9 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -39,7 +39,7 @@ struct stage_t {
/* minimally initialize a stage to carry an object */
-static void _stage_set_object(stage_t *stage, const char *name, const stage_ops_t *ops, void *object)
+static stage_t * _stage_set_object(stage_t *stage, const char *name, const stage_ops_t *ops, void *object)
{
static stage_ops_t null_ops = {};
@@ -52,6 +52,8 @@ static void _stage_set_object(stage_t *stage, const char *name, const stage_ops_
strncpy(stage->name, name, sizeof(stage->name));
stage->ops = ops;
stage->object = object;
+
+ return stage;
}
@@ -68,9 +70,7 @@ static stage_t * _stage_new(const char *name, const stage_ops_t *ops, void *obje
for (int i = 0; i < STAGE_LAYERS_MAX; i++)
dll_init(&stage->layers[i]);
- _stage_set_object(stage, name, ops, object);
-
- return stage;
+ return _stage_set_object(stage, name, ops, object);
}
@@ -115,14 +115,14 @@ stage_t * stage_new(const stage_conf_t *conf, const stage_ops_t *ops, void *obje
/* replaces a given stage's object-related properties but otherwise keeping the existing state */
-void stage_replace(stage_t *stage, const char *name, const stage_ops_t *ops, void *object)
+stage_t * stage_replace(stage_t *stage, const char *name, const stage_ops_t *ops, void *object)
{
assert(stage);
if (stage->ops->free_func)
stage->ops->free_func(stage, stage->object);
- _stage_set_object(stage, name, ops, object);
+ return _stage_set_object(stage, name, ops, object);
}
diff --git a/src/stage.h b/src/stage.h
index d1c8e69..ec0a72b 100644
--- a/src/stage.h
+++ b/src/stage.h
@@ -43,7 +43,7 @@ typedef struct stage_conf_t {
} stage_conf_t;
stage_t * stage_new(const stage_conf_t *conf, const stage_ops_t *ops, void *object);
-void stage_replace(stage_t *stage, const char *name, const stage_ops_t *ops, void *object);
+stage_t * stage_replace(stage_t *stage, const char *name, const stage_ops_t *ops, void *object);
stage_t * stage_free(stage_t *stage);
int stage_render(stage_t *stage, void *render_ctxt);
© All Rights Reserved