summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-25 07:46:37 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-25 07:46:37 -0700
commit298f023e1f2767d0ac5f79de1bdbedf5198ba4a5 (patch)
tree27f3e761a9268bad6395664044618accfe75f34c
parente5f4697f91550d80b1587fe38fcab8f9a27f7950 (diff)
downloadsubsurface-298f023e1f2767d0ac5f79de1bdbedf5198ba4a5.tar.gz
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>
-rw-r--r--save-git.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/save-git.c b/save-git.c
index 1914a07ee..a18ef8f84 100644
--- a/save-git.c
+++ b/save-git.c
@@ -891,14 +891,13 @@ static void save_divesites(git_repository *repo, struct dir *tree)
i--; // since we just deleted that one
continue;
}
- int size = sizeof("Site-012345678");
- char name[size];
- snprintf(name, size, "Site-%08x", ds->uuid);
+ struct membuffer site_file_name = { 0 };
+ put_format(&site_file_name, "Site-%08x", ds->uuid);
show_utf8(&b, "name ", ds->name, "\n");
show_utf8(&b, "description ", ds->description, "\n");
show_utf8(&b, "notes ", ds->notes, "\n");
show_gps(&b, ds->latitude, ds->longitude);
- blob_insert(repo, subdir, &b, name);
+ blob_insert(repo, subdir, &b, mb_cstring(&site_file_name));
}
}