]> granicus.if.org Git - icinga2/blobdiff - lib/base/boolean-script.cpp
Merge pull request #6718 from Icinga/bugfix/ssl-shutdown
[icinga2] / lib / base / boolean-script.cpp
index d262ed5c6dc9d72f0f147fdbde0c036e0b94cc79..aab8ff0e5cb8b148657b905e0ab3bd2a2fd4dbe0 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://icinga.com/)      *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
 
 using namespace icinga;
 
-static String BooleanToString(void)
+static String BooleanToString()
 {
        ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
        bool self = vframe->Self;
        return self ? "true" : "false";
 }
 
-Object::Ptr Boolean::GetPrototype(void)
+Object::Ptr Boolean::GetPrototype()
 {
-       static Dictionary::Ptr prototype;
-
-       if (!prototype) {
-               prototype = new Dictionary();
-               prototype->Set("to_string", new Function(WrapFunction(BooleanToString), true));
-       }
+       static Dictionary::Ptr prototype = new Dictionary({
+               { "to_string", new Function("Boolean#to_string", BooleanToString, {}, true) }
+       });
 
        return prototype;
 }