[gjs: 4/6] coverage: use GjsAutoPointer to create lcov ptr
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 4/6] coverage: use GjsAutoPointer to create lcov ptr
- Date: Sun, 14 Oct 2018 03:50:21 +0000 (UTC)
commit 4f7c81df2143c67de5b1726c11a09ef366bbd6cb
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Wed Oct 10 04:24:59 2018 +0200
coverage: use GjsAutoPointer to create lcov ptr
gjs/coverage.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 9ac2232b..68cf0d3d 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -199,8 +199,6 @@ write_statistics_internal(GjsCoverage *coverage,
JSContext *cx,
GError **error)
{
- using AutoCChar = std::unique_ptr<char, decltype(&free)>;
-
GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
/* Create output directory if it doesn't exist */
@@ -213,7 +211,8 @@ write_statistics_internal(GjsCoverage *coverage,
GFile *output_file = g_file_get_child(priv->output_dir, "coverage.lcov");
size_t lcov_length;
- AutoCChar lcov(js::GetCodeCoverageSummary(cx, &lcov_length), free);
+ GjsAutoPointer<char, void, free> lcov(
+ js::GetCodeCoverageSummary(cx, &lcov_length));
GjsAutoUnref<GOutputStream> ostream =
G_OUTPUT_STREAM(g_file_append_to(output_file,
@@ -224,7 +223,7 @@ write_statistics_internal(GjsCoverage *coverage,
return nullptr;
GjsAutoStrv lcov_lines = g_strsplit(lcov, "\n", -1);
- GjsAutoChar test_name;
+ const char* test_name = NULL;
bool ignoring_file = false;
for (const char * const *iter = lcov_lines.get(); *iter; iter++) {
@@ -247,7 +246,7 @@ write_statistics_internal(GjsCoverage *coverage,
}
/* Now we can write the test name before writing the source file */
- if (!write_line(ostream, test_name.get(), error))
+ if (!write_line(ostream, test_name, error))
return nullptr;
/* The source file could be a resource, so we must use
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]