summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/save-git.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/core/save-git.c b/core/save-git.c
index 4c8969047..041f01223 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -845,21 +845,22 @@ static void save_units(void *_b)
prefs.units.vertical_speed_time == SECONDS ? "SECONDS" : "MINUTES");
}
-static void save_one_device(void *_b, const char *model, uint32_t deviceid,
- const char *nickname, const char *serial, const char *firmware)
+static void save_one_device(struct membuffer *b, const struct device *d)
{
- struct membuffer *b = _b;
-
- if (nickname && !strcmp(model, nickname))
+ const char *model = device_get_model(d);
+ const char *nickname = device_get_nickname(d);
+ const char *serial = device_get_serial(d);
+ const char *firmware = device_get_firmware(d);
+ if (!empty_string(nickname) && !strcmp(model, nickname))
nickname = NULL;
- if (serial && !*serial) serial = NULL;
- if (firmware && !*firmware) firmware = NULL;
- if (nickname && !*nickname) nickname = NULL;
+ if (empty_string(serial)) serial = NULL;
+ if (empty_string(firmware)) firmware = NULL;
+ if (empty_string(nickname)) nickname = NULL;
if (!nickname && !serial && !firmware)
return;
show_utf8(b, "divecomputerid ", model, "");
- put_format(b, " deviceid=%08x", deviceid);
+ put_format(b, " deviceid=%08x", device_get_id(d));
show_utf8(b, " serial=", serial, "");
show_utf8(b, " firmware=", firmware, "");
show_utf8(b, " nickname=", nickname, "");
@@ -871,7 +872,8 @@ static void save_settings(git_repository *repo, struct dir *tree)
struct membuffer b = { 0 };
put_format(&b, "version %d\n", DATAFORMAT_VERSION);
- call_for_each_dc(&b, save_one_device, false);
+ for (int i = 0; i < nr_devices(&device_table); i++)
+ save_one_device(&b, get_device(&device_table, i));
cond_put_format(autogroup, &b, "autogroup\n");
save_units(&b);
if (prefs.tankbar)