[gjs/auto-pointers-builder: 3/4] global: use GjsAutoBuilder for GBytes



commit 1c0dfeaf2f3c1ac3f0461d84da60bb10654d50c3
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Oct 10 04:03:27 2018 +0200

    global: use GjsAutoBuilder for GBytes

 gjs/global.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gjs/global.cpp b/gjs/global.cpp
index 2ea9b6df..7465fd5e 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -38,9 +38,9 @@ run_bootstrap(JSContext       *cx,
     GjsAutoChar path = g_strdup_printf("/org/gnome/gjs/modules/_bootstrap/%s.js",
                                        bootstrap_script);
     GError *error = nullptr;
-    std::unique_ptr<GBytes, decltype(&g_bytes_unref)> script_bytes(
-        g_resources_lookup_data(path, G_RESOURCE_LOOKUP_FLAGS_NONE, &error),
-        g_bytes_unref);
+    GjsAutoPointer<GBytes, GBytes, g_bytes_unref> script_bytes;
+    script_bytes =
+        g_resources_lookup_data(path, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
     if (!script_bytes)
         return gjs_throw_gerror_message(cx, error);
 
@@ -54,8 +54,8 @@ run_bootstrap(JSContext       *cx,
 
     JS::RootedScript compiled_script(cx);
     size_t script_len;
-    auto script = static_cast<const char *>(g_bytes_get_data(script_bytes.get(),
-                                            &script_len));
+    auto script =
+        static_cast<const char*>(g_bytes_get_data(script_bytes, &script_len));
     if (!JS::Compile(cx, options, script, script_len, &compiled_script))
         return false;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]