From f96a0887eae53fd40633418689b8ddcb054b640d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 20 Aug 2014 23:15:39 +0200 Subject: Insert SCBlock for new slide in the right place --- src/sc_parse.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/sc_parse.c') diff --git a/src/sc_parse.c b/src/sc_parse.c index a37775d..0881464 100644 --- a/src/sc_parse.c +++ b/src/sc_parse.c @@ -170,6 +170,27 @@ SCBlock *sc_block_append_inside(SCBlock *parent, } +/* Insert a new block to the chain, just after "afterme". + * "name", "options" and "contents" will not be copied. Returns the block just + * created, or NULL on error. */ +SCBlock *sc_block_insert_after(SCBlock *afterme, + char *name, char *opt, char *contents) +{ + SCBlock *bl; + + bl = sc_block_new(); + if ( bl == NULL ) return NULL; + + bl->name = name; + bl->options = opt; + bl->contents = contents; + bl->child = NULL; + bl->next = afterme->next; + afterme->next = bl; + + return bl; +} + /* Frees "bl" and all its children */ void sc_block_free(SCBlock *bl) -- cgit v1.2.3