summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-02-22 20:52:50 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit92e6e2bba17ae91e1f8e5d63154323586f6ea5a2 (patch)
tree2b71b7b8bf41026c016cb7b0654d9bfdcd49fb7a /core/dive.c
parent53b4d84a6ebebc4792f3b03cb926a454075fda34 (diff)
downloadsubsurface-92e6e2bba17ae91e1f8e5d63154323586f6ea5a2.tar.gz
Core: introduce taglist_copy() function
Taglists were only copied in dive.c using the STRUCTURED_LIST_COPY macro. Export that functionality in a function. This will be needed for undo of dive-pasting. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c
index f43697c65..b82970862 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -667,7 +667,7 @@ void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_compo
add_dive_to_dive_site(d, s->dive_site);
}
if (what.tags)
- STRUCTURED_LIST_COPY(struct tag_entry, s->tag_list, d->tag_list, copy_tl);
+ d->tag_list = taglist_copy(s->tag_list);
if (what.cylinders)
copy_cylinders(s, d, false);
if (what.weights)
@@ -3359,6 +3359,13 @@ void taglist_free(struct tag_entry *entry)
STRUCTURED_LIST_FREE(struct tag_entry, entry, free)
}
+struct tag_entry *taglist_copy(struct tag_entry *s)
+{
+ struct tag_entry *res;
+ STRUCTURED_LIST_COPY(struct tag_entry, s, res, copy_tl);
+ return res;
+}
+
/* Merge src1 and src2, write to *dst */
static void taglist_merge(struct tag_entry **dst, struct tag_entry *src1, struct tag_entry *src2)
{