diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-11-06 22:02:22 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-07 12:59:08 -0800 |
commit | 9aefaa1ec87aff88bb1170bd6a79b76d351f804f (patch) | |
tree | 09a0a87fdc9e84c6402c53abb216a0867a3b4d88 /dive.c | |
parent | 77621ef7df1005a26d2701f22342d0d64e589708 (diff) | |
download | subsurface-9aefaa1ec87aff88bb1170bd6a79b76d351f804f.tar.gz |
Add helper function to add extra_data to dive computer
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r-- | dive.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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) { |