summaryrefslogtreecommitdiff
path: root/src/stage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage.c')
-rw-r--r--src/stage.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stage.c b/src/stage.c
index 13519b9..8a540a8 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -88,14 +88,19 @@ static void _stage_free(stage_t *stage)
/* returns a new stage, attached at the specified layer under parent if supplied */
/* layer has no effect when parent == NULL */
+/* if adopt is set, parent must be set and is instead replaced internally and returned */
stage_t * stage_new(const stage_conf_t *conf, const stage_ops_t *ops, void *object)
{
stage_t *stage;
assert(conf);
assert(conf->parent || !conf->layer);
+ assert(conf->parent || !conf->adopt);
assert(conf->layer < STAGE_LAYERS_MAX);
+ if (conf->adopt)
+ return stage_replace(conf->parent, conf->name, ops, object);
+
stage = _stage_new(conf->name, ops, object);
if (!stage)
return NULL;
© All Rights Reserved