@@ -67,66 +67,48 @@ class I2_BASE_API Function : public ObjectImpl<Function>
67
67
};
68
68
69
69
#define REGISTER_SCRIPTFUNCTION_NS (ns, name, callback ) \
70
- namespace { namespace UNIQUE_NAME ( sf) { namespace sf ## ns ## name { \
71
- void RegisterFunction (void ) { \
72
- Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), false ); \
73
- ScriptGlobal::Set (#ns " ." #name, sf); \
74
- } \
75
- INITIALIZE_ONCE_WITH_PRIORITY (RegisterFunction, 10 ); \
76
- } } }
70
+ INITIALIZE_ONCE_WITH_PRIORITY ([]() { \
71
+ Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), false ); \
72
+ ScriptGlobal::Set (#ns " ." #name, sf); \
73
+ }, 10 )
77
74
78
75
#define REGISTER_SCRIPTFUNCTION_NS_PREFIX (ns, name, callback ) \
79
- namespace { namespace UNIQUE_NAME ( sf) { namespace sf ## ns ## name { \
80
- void RegisterFunction (void ) { \
81
- Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), false ); \
82
- ScriptGlobal::Set (#ns " ." #name, sf); \
83
- Function::Ptr dsf = new icinga::Function (" Deprecated#__" #name " (deprecated)" , WrapFunction (callback), false , true ); \
84
- ScriptGlobal::Set (" Deprecated.__" #name, dsf); \
85
- } \
86
- INITIALIZE_ONCE_WITH_PRIORITY (RegisterFunction, 10 ); \
87
- } } }
76
+ INITIALIZE_ONCE_WITH_PRIORITY ([]() { \
77
+ Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), false ); \
78
+ ScriptGlobal::Set (#ns " ." #name, sf); \
79
+ Function::Ptr dsf = new icinga::Function (" Deprecated#__" #name " (deprecated)" , WrapFunction (callback), false , true ); \
80
+ ScriptGlobal::Set (" Deprecated.__" #name, dsf); \
81
+ }, 10 )
88
82
89
83
#define REGISTER_SCRIPTFUNCTION_NS_DEPRECATED (ns, name, callback ) \
90
- namespace { namespace UNIQUE_NAME ( sf) { namespace sf ## ns ## name { \
91
- void RegisterFunction (void ) { \
92
- Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), false ); \
93
- ScriptGlobal::Set (#ns " ." #name, sf); \
94
- Function::Ptr dsf = new icinga::Function (" Deprecated#" #name " (deprecated)" , WrapFunction (callback), false , true ); \
95
- ScriptGlobal::Set (" Deprecated." #name, dsf); \
96
- } \
97
- INITIALIZE_ONCE_WITH_PRIORITY (RegisterFunction, 10 ); \
98
- } } }
84
+ INITIALIZE_ONCE_WITH_PRIORITY ([]() { \
85
+ Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), false ); \
86
+ ScriptGlobal::Set (#ns " ." #name, sf); \
87
+ Function::Ptr dsf = new icinga::Function (" Deprecated#" #name " (deprecated)" , WrapFunction (callback), false , true ); \
88
+ ScriptGlobal::Set (" Deprecated." #name, dsf); \
89
+ }, 10 )
99
90
100
91
#define REGISTER_SAFE_SCRIPTFUNCTION_NS (ns, name, callback ) \
101
- namespace { namespace UNIQUE_NAME ( sf) { namespace sf ## ns ## name { \
102
- void RegisterFunction (void ) { \
103
- Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), true ); \
104
- ScriptGlobal::Set (#ns " ." #name, sf); \
105
- } \
106
- INITIALIZE_ONCE_WITH_PRIORITY (RegisterFunction, 10 ); \
107
- } } }
92
+ INITIALIZE_ONCE_WITH_PRIORITY ([]() { \
93
+ Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), true ); \
94
+ ScriptGlobal::Set (#ns " ." #name, sf); \
95
+ }, 10 )
108
96
109
97
#define REGISTER_SAFE_SCRIPTFUNCTION_NS_PREFIX (ns, name, callback ) \
110
- namespace { namespace UNIQUE_NAME ( sf) { namespace sf ## ns ## name { \
111
- void RegisterFunction (void ) { \
112
- Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), true ); \
113
- ScriptGlobal::Set (#ns " ." #name, sf); \
114
- Function::Ptr dsf = new icinga::Function (" Deprecated#__" #name " (deprecated)" , WrapFunction (callback), true , true ); \
115
- ScriptGlobal::Set (" Deprecated.__" #name, dsf); \
116
- } \
117
- INITIALIZE_ONCE_WITH_PRIORITY (RegisterFunction, 10 ); \
118
- } } }
98
+ INITIALIZE_ONCE_WITH_PRIORITY ([]() { \
99
+ Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), true ); \
100
+ ScriptGlobal::Set (#ns " ." #name, sf); \
101
+ Function::Ptr dsf = new icinga::Function (" Deprecated#__" #name " (deprecated)" , WrapFunction (callback), true , true ); \
102
+ ScriptGlobal::Set (" Deprecated.__" #name, dsf); \
103
+ }, 10 )
119
104
120
105
#define REGISTER_SAFE_SCRIPTFUNCTION_NS_DEPRECATED (ns, name, callback ) \
121
- namespace { namespace UNIQUE_NAME ( sf) { namespace sf ## ns ## name { \
122
- void RegisterFunction (void ) { \
123
- Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), true ); \
124
- ScriptGlobal::Set (#ns " ." #name, sf); \
125
- Function::Ptr dsf = new icinga::Function (" Deprecated#" #name " (deprecated)" , WrapFunction (callback), true , true ); \
126
- ScriptGlobal::Set (" Deprecated." #name, dsf); \
127
- } \
128
- INITIALIZE_ONCE_WITH_PRIORITY (RegisterFunction, 10 ); \
129
- } } }
106
+ INITIALIZE_ONCE_WITH_PRIORITY ([]() { \
107
+ Function::Ptr sf = new icinga::Function (#ns " #" #name, WrapFunction (callback), true ); \
108
+ ScriptGlobal::Set (#ns " ." #name, sf); \
109
+ Function::Ptr dsf = new icinga::Function (" Deprecated#" #name " (deprecated)" , WrapFunction (callback), true , true ); \
110
+ ScriptGlobal::Set (" Deprecated." #name, dsf); \
111
+ }, 10 )
130
112
131
113
}
132
114
0 commit comments