diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/src/plugin.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugin/src/plugin.c b/plugin/src/plugin.c index e2aae1f..3a0ef5d 100644 --- a/plugin/src/plugin.c +++ b/plugin/src/plugin.c | |||
@@ -64,14 +64,14 @@ static bool load_library(Plugin* plugin) { | |||
64 | // Handle reloading a previously-loaded library. | 64 | // Handle reloading a previously-loaded library. |
65 | if (plugin->handle) { | 65 | if (plugin->handle) { |
66 | dlclose(plugin->handle); | 66 | dlclose(plugin->handle); |
67 | plugin->handle = 0; | 67 | plugin->handle = nullptr; |
68 | } | 68 | } |
69 | 69 | ||
70 | const mstring lib = plugin_lib_path(plugin); | 70 | const mstring lib = plugin_lib_path(plugin); |
71 | 71 | ||
72 | // If the plugin fails to load, make sure to keep the plugin's old handle to | 72 | // If the plugin fails to load, make sure to keep the plugin's old handle to |
73 | // handle the error gracefully. This handles reload failures, specifically. | 73 | // handle the error gracefully. This handles reload failures, specifically. |
74 | void* handle = 0; | 74 | void* handle = nullptr; |
75 | if ((handle = dlopen(mstring_cstr(&lib), RTLD_NOW))) { | 75 | if ((handle = dlopen(mstring_cstr(&lib), RTLD_NOW))) { |
76 | LOGD("Plugin [%s] loaded successfully", mstring_cstr(&plugin->filename)); | 76 | LOGD("Plugin [%s] loaded successfully", mstring_cstr(&plugin->filename)); |
77 | plugin->handle = handle; | 77 | plugin->handle = handle; |
@@ -86,7 +86,7 @@ static bool load_library(Plugin* plugin) { | |||
86 | static void delete_plugin_state(Plugin* plugin) { | 86 | static void delete_plugin_state(Plugin* plugin) { |
87 | if (plugin->state) { | 87 | if (plugin->state) { |
88 | free(plugin->state); | 88 | free(plugin->state); |
89 | plugin->state = 0; | 89 | plugin->state = nullptr; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
@@ -105,7 +105,7 @@ static void destroy_plugin(Plugin* plugin) { | |||
105 | if (plugin) { | 105 | if (plugin) { |
106 | if (plugin->handle) { | 106 | if (plugin->handle) { |
107 | dlclose(plugin->handle); | 107 | dlclose(plugin->handle); |
108 | plugin->handle = 0; | 108 | plugin->handle = nullptr; |
109 | } | 109 | } |
110 | delete_plugin_state(plugin); | 110 | delete_plugin_state(plugin); |
111 | } | 111 | } |
@@ -118,7 +118,7 @@ Plugin* load_plugin(PluginEngine* eng, const char* filename) { | |||
118 | Plugin plugin = (Plugin){.eng = eng, .filename = mstring_make(filename)}; | 118 | Plugin plugin = (Plugin){.eng = eng, .filename = mstring_make(filename)}; |
119 | 119 | ||
120 | if (!load_library(&plugin)) { | 120 | if (!load_library(&plugin)) { |
121 | return 0; | 121 | return nullptr; |
122 | } | 122 | } |
123 | 123 | ||
124 | list_add(eng->plugins, plugin); | 124 | list_add(eng->plugins, plugin); |
@@ -132,7 +132,7 @@ void delete_plugin(Plugin** pPlugin) { | |||
132 | assert(plugin->eng); | 132 | assert(plugin->eng); |
133 | destroy_plugin(plugin); | 133 | destroy_plugin(plugin); |
134 | list_remove_ptr(plugin->eng->plugins, plugin); | 134 | list_remove_ptr(plugin->eng->plugins, plugin); |
135 | *pPlugin = 0; | 135 | *pPlugin = nullptr; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
@@ -148,7 +148,7 @@ bool plugin_reloaded(Plugin* plugin) { | |||
148 | // ----------------------------------------------------------------------------- | 148 | // ----------------------------------------------------------------------------- |
149 | 149 | ||
150 | PluginEngine* new_plugin_engine(const PluginEngineDesc* desc) { | 150 | PluginEngine* new_plugin_engine(const PluginEngineDesc* desc) { |
151 | PluginEngine* eng = 0; | 151 | PluginEngine* eng = nullptr; |
152 | 152 | ||
153 | if (!(eng = calloc(1, sizeof(PluginEngine)))) { | 153 | if (!(eng = calloc(1, sizeof(PluginEngine)))) { |
154 | goto cleanup; | 154 | goto cleanup; |
@@ -173,7 +173,7 @@ PluginEngine* new_plugin_engine(const PluginEngineDesc* desc) { | |||
173 | 173 | ||
174 | cleanup: | 174 | cleanup: |
175 | delete_plugin_engine(&eng); | 175 | delete_plugin_engine(&eng); |
176 | return 0; | 176 | return nullptr; |
177 | } | 177 | } |
178 | 178 | ||
179 | void delete_plugin_engine(PluginEngine** pEng) { | 179 | void delete_plugin_engine(PluginEngine** pEng) { |
@@ -191,7 +191,7 @@ void delete_plugin_engine(PluginEngine** pEng) { | |||
191 | close(eng->inotify_instance); | 191 | close(eng->inotify_instance); |
192 | } | 192 | } |
193 | free(eng); | 193 | free(eng); |
194 | *pEng = 0; | 194 | *pEng = nullptr; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | 197 | ||