mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add helper function to add extra_data to dive computer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
77621ef7df
commit
9aefaa1ec8
2 changed files with 15 additions and 0 deletions
14
dive.c
14
dive.c
|
@ -145,6 +145,20 @@ void update_event_name(struct dive *d, struct event *event, char *name)
|
|||
free(remove);
|
||||
}
|
||||
|
||||
void add_extra_data(struct divecomputer *dc, const char *key, const char *value)
|
||||
{
|
||||
struct extra_data **ed = &dc->extra_data;
|
||||
|
||||
while (*ed)
|
||||
ed = &(*ed)->next;
|
||||
*ed = malloc(sizeof(struct extra_data));
|
||||
if (*ed) {
|
||||
(*ed)->key = strdup(key);
|
||||
(*ed)->value = strdup(value);
|
||||
(*ed)->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* this returns a pointer to static variable - so use it right away after calling */
|
||||
struct gasmix *get_gasmix_from_event(struct event *ev)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue