summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/equipment.c16
-rw-r--r--core/equipment.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/core/equipment.c b/core/equipment.c
index 39505a39d..bd1a0b4e3 100644
--- a/core/equipment.c
+++ b/core/equipment.c
@@ -111,12 +111,24 @@ void add_weightsystem_description(const weightsystem_t *weightsystem)
}
}
+weightsystem_t clone_weightsystem(weightsystem_t ws)
+{
+ weightsystem_t res = { ws.weight, copy_string(ws.description) };
+ return res;
+}
+
/* Add a clone of a weightsystem to the end of a weightsystem table.
* Cloned in means that the description-string is copied. */
void add_cloned_weightsystem(struct weightsystem_table *t, weightsystem_t ws)
{
- weightsystem_t w_clone = { ws.weight, copy_string(ws.description) };
- add_to_weightsystem_table(t, t->nr, w_clone);
+ add_to_weightsystem_table(t, t->nr, clone_weightsystem(ws));
+}
+
+/* Add a clone of a weightsystem to the end of a weightsystem table.
+ * Cloned in means that the description-string is copied. */
+void add_cloned_weightsystem_at(struct weightsystem_table *t, weightsystem_t ws)
+{
+ add_to_weightsystem_table(t, t->nr, clone_weightsystem(ws));
}
/* Add a clone of a cylinder to the end of a cylinder table.
diff --git a/core/equipment.h b/core/equipment.h
index 86e23f9f8..687e794a5 100644
--- a/core/equipment.h
+++ b/core/equipment.h
@@ -67,6 +67,7 @@ struct weightsystem_table {
extern int cylinderuse_from_text(const char *text);
extern void copy_weights(const struct weightsystem_table *s, struct weightsystem_table *d);
+extern weightsystem_t clone_weightsystem(weightsystem_t ws);
extern void copy_cylinder_types(const struct dive *s, struct dive *d);
extern void add_cloned_weightsystem(struct weightsystem_table *t, weightsystem_t ws);
extern cylinder_t *add_empty_cylinder(struct cylinder_table *t);