mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
53b4d84a6e
commit
92e6e2bba1
2 changed files with 9 additions and 1 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -221,6 +221,7 @@ void taglist_cleanup(struct tag_entry **tag_list);
|
|||
|
||||
void taglist_init_global();
|
||||
void taglist_free(struct tag_entry *tag_list);
|
||||
struct tag_entry *taglist_copy(struct tag_entry *s);
|
||||
bool taglist_contains(struct tag_entry *tag_list, const char *tag);
|
||||
|
||||
struct extra_data {
|
||||
|
|
Loading…
Add table
Reference in a new issue