summaryrefslogtreecommitdiff
path: root/gjs/profiler.cpp
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2018-10-10 04:03:06 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2018-10-14 05:28:59 +0200
commit0824b6cd85aa7ec74ac8d8473488e771797cdbae (patch)
treeba001e4400a780e9833b138e92b19ab6fb025474 /gjs/profiler.cpp
parentdab3c7d06b7e80ec778bf5a326e2588c8553a09c (diff)
downloadgjs-0824b6cd85aa7ec74ac8d8473488e771797cdbae.tar.gz
jsapi-util: add definition for gstrfreev auto-pointer
And use it where convenient
Diffstat (limited to 'gjs/profiler.cpp')
-rw-r--r--gjs/profiler.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/gjs/profiler.cpp b/gjs/profiler.cpp
index 41fc1b79..a23c85b7 100644
--- a/gjs/profiler.cpp
+++ b/gjs/profiler.cpp
@@ -126,8 +126,6 @@ static GjsContext *profiling_context;
static bool
gjs_profiler_extract_maps(GjsProfiler *self)
{
- using AutoStrv = std::unique_ptr<char *, decltype(&g_strfreev)>;
-
int64_t now = g_get_monotonic_time() * 1000L;
g_assert(((void) "Profiler must be set up before extracting maps", self));
@@ -140,9 +138,9 @@ gjs_profiler_extract_maps(GjsProfiler *self)
return false;
GjsAutoChar content = content_tmp;
- AutoStrv lines(g_strsplit(content, "\n", 0), g_strfreev);
+ GjsAutoStrv lines = g_strsplit(content, "\n", 0);
- for (size_t ix = 0; lines.get()[ix]; ix++) {
+ for (size_t ix = 0; lines[ix]; ix++) {
char file[256];
unsigned long start;
unsigned long end;
@@ -151,7 +149,7 @@ gjs_profiler_extract_maps(GjsProfiler *self)
file[sizeof file - 1] = '\0';
- int r = sscanf(lines.get()[ix], "%lx-%lx %*15s %lx %*x:%*x %lu %255s",
+ int r = sscanf(lines[ix], "%lx-%lx %*15s %lx %*x:%*x %lu %255s",
&start, &end, &offset, &inode, file);
if (r != 5)
continue;