mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use our membuffer infrastructure to assemble string
We should use this consistently throughout the code instead of manually assembling strings and messing with memory all over the place. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e5f4697f91
commit
298f023e1f
1 changed files with 3 additions and 4 deletions
|
@ -891,14 +891,13 @@ static void save_divesites(git_repository *repo, struct dir *tree)
|
||||||
i--; // since we just deleted that one
|
i--; // since we just deleted that one
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int size = sizeof("Site-012345678");
|
struct membuffer site_file_name = { 0 };
|
||||||
char name[size];
|
put_format(&site_file_name, "Site-%08x", ds->uuid);
|
||||||
snprintf(name, size, "Site-%08x", ds->uuid);
|
|
||||||
show_utf8(&b, "name ", ds->name, "\n");
|
show_utf8(&b, "name ", ds->name, "\n");
|
||||||
show_utf8(&b, "description ", ds->description, "\n");
|
show_utf8(&b, "description ", ds->description, "\n");
|
||||||
show_utf8(&b, "notes ", ds->notes, "\n");
|
show_utf8(&b, "notes ", ds->notes, "\n");
|
||||||
show_gps(&b, ds->latitude, ds->longitude);
|
show_gps(&b, ds->latitude, ds->longitude);
|
||||||
blob_insert(repo, subdir, &b, name);
|
blob_insert(repo, subdir, &b, mb_cstring(&site_file_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue