devices: create device nodes in parsers

So far, we added a non-global device table to the parser states.
Now, create device nodes in that table instead of in the global
table. Thus, on undo of dive-import, the new device nodes will
be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-10-18 23:42:17 +02:00 committed by Dirk Hohndel
parent 255f561aff
commit 8c65558b5c
6 changed files with 23 additions and 14 deletions

View file

@ -361,9 +361,9 @@ int parse_file(const char *filename, struct dive_table *table, struct trip_table
wl_name = strcat(wl_name, ".add");
if((ret = readfile(wl_name, &wl_mem)) < 0) {
fprintf(stderr, "No file %s found. No WLog extensions.\n", wl_name);
ret = datatrak_import(&mem, NULL, table, trips, sites);
ret = datatrak_import(&mem, NULL, table, trips, sites, devices);
} else {
ret = datatrak_import(&mem, &wl_mem, table, trips, sites);
ret = datatrak_import(&mem, &wl_mem, table, trips, sites, devices);
free(wl_mem.buffer);
}
free(mem.buffer);