[gjs: 6/9] gtype: use Atomized string for static ones



commit 0b06014414b7b526c2cd695d45a7ea23b55ff296
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sat Oct 13 19:44:03 2018 -0500

    gtype: use Atomized string for static ones
    
    We can avoid doing a copy of the string for a static one

 gi/gtype.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index 5ef79579..67bdad45 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -98,7 +98,8 @@ to_string_func(JSContext *cx,
     GType gtype = GPOINTER_TO_SIZE(priv);
 
     if (gtype == 0) {
-        JS::RootedString str(cx, JS_NewStringCopyZ(cx, "[object GType prototype]"));
+        JS::RootedString str(cx,
+                             JS_AtomizeString(cx, "[object GType prototype]"));
         if (!str)
             return false;
         rec.rval().setString(str);


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