aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/slide.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-01-25 15:30:59 +0100
committerThomas White <taw@physics.org>2020-01-25 15:30:59 +0100
commit7f6f418e5d5d31e2617b613c3cfe3a2da004b56c (patch)
treefb17a543532c90eeeb09f9640d993b333330e82e /libstorycode/slide.c
parente6d94b1b6c9a8b74d7faa7e80d7a44f604c4e814 (diff)
Fix semantics of slide_add_item
Diffstat (limited to 'libstorycode/slide.c')
-rw-r--r--libstorycode/slide.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libstorycode/slide.c b/libstorycode/slide.c
index f5728c7..a3423c4 100644
--- a/libstorycode/slide.c
+++ b/libstorycode/slide.c
@@ -82,17 +82,18 @@ static SlideItem *slide_item_new()
}
-void slide_add_item(Slide *s, SlideItem *item)
+SlideItem *slide_add_item(Slide *s, SlideItem *item)
{
SlideItem *new_items;
new_items = realloc(s->items, (s->n_items+1)*sizeof(SlideItem));
- if ( new_items == NULL ) return;
+ if ( new_items == NULL ) return NULL;
s->items = new_items;
/* Copy contents and free top-level */
s->items[s->n_items++] = *item;
free(item);
+ return &s->items[s->n_items-1];
}