[gjs] GjsAutoChar: Add a proper operator= (const char*)



commit 2ff21f1cc69285596ca2b03b4e5f8569c1aa59dc
Author: Daniel Boles <dboles src gnome org>
Date:   Thu Jun 15 09:42:05 2017 +0100

    GjsAutoChar: Add a proper operator= (const char*)
    
    Assignment from const char* is a valid thing to do, so long as we copy
    it and manage the copy.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777597

 gjs/jsapi-util.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 57da626..917aaf6 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -44,6 +44,10 @@ public:
     void operator= (char *str) {
         reset(str);
     }
+
+    void operator= (const char *str) {
+        reset(g_strdup(str));
+    }
 };
 
 template <typename T>


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