--- a/gplugin/gplugin-loader.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/gplugin-loader.c Fri Jan 25 00:50:20 2019 -0500
@@ -103,9 +103,9 @@
ret = klass->load(loader, plugin, error);
- if(!ret && error && *error == NULL) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- "Failed to load plugin : unknown");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + "Failed to load plugin : unknown"); @@ -138,9 +138,9 @@
if(klass && klass->unload)
ret = klass->unload(loader, plugin, error);
- if(!ret && error && *error == NULL) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- "Failed to unload plugin : unknown");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + "Failed to unload plugin : unknown"); --- a/gplugin/gplugin-manager.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/gplugin-manager.c Fri Jan 25 00:50:20 2019 -0500
@@ -775,11 +775,9 @@
/* now try to get the plugin info from the plugin */
info = gplugin_plugin_get_info(plugin);
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("Plugin %s did not return value plugin info"),
- gplugin_plugin_get_filename(plugin));
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + _("Plugin %s did not return value plugin info"), + gplugin_plugin_get_filename(plugin)); gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
@@ -798,12 +796,10 @@
loader = gplugin_plugin_get_loader(plugin);
if(!GPLUGIN_IS_LOADER(loader)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("The loader for %s is not a loader. This "
- "should not happened!"),
- gplugin_plugin_get_filename(plugin));
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + _("The loader for %s is not a loader. This " + "should not happened!"), + gplugin_plugin_get_filename(plugin)); gplugin_plugin_set_state(plugin, GPLUGIN_PLUGIN_STATE_LOAD_FAILED);
@@ -844,10 +840,8 @@
loader = gplugin_plugin_get_loader(plugin);
if(!GPLUGIN_IS_LOADER(loader)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("Plugin loader is not a loader"));
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + _("Plugin loader is not a loader")); --- a/gplugin/gplugin-native-loader.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/gplugin-native-loader.c Fri Jan 25 00:50:20 2019 -0500
@@ -59,11 +59,8 @@
g_return_val_if_fail(module != NULL, NULL);
if(!g_module_symbol(module, name, &symbol)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("symbol %s was not found"), name);
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + _("symbol %s was not found"), name); @@ -149,11 +146,9 @@
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("the query function did not return a "
- "GPluginPluginInfo instance"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, + _("the query function did not return a " + "GPluginPluginInfo instance")); @@ -168,11 +163,9 @@
if(!GPLUGIN_IS_PLUGIN_INFO(info)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("the query function did not return a "
- "GPluginPluginInfo instance"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, + _("the query function did not return a " + "GPluginPluginInfo instance")); @@ -215,10 +208,8 @@
g_object_unref(G_OBJECT(info));
if(!GPLUGIN_IS_NATIVE_PLUGIN(plugin)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("failed to create plugin instance"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, + _("failed to create plugin instance")); @@ -238,8 +229,7 @@
/* get and call the function */
g_object_get(G_OBJECT(plugin), "load-func", &func, NULL);
if(!func(GPLUGIN_NATIVE_PLUGIN(plugin), error)) {
- if(error && *error == NULL)
- *error = g_error_new(GPLUGIN_DOMAIN, 0, _("unknown failure"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, _("unknown failure")); @@ -271,8 +261,7 @@
/* now call the function */
if(!func(GPLUGIN_NATIVE_PLUGIN(plugin), error)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, _("unknown failure"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, _("unknown failure")); --- a/gplugin/gplugin-version.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/gplugin-version.c Fri Jan 25 00:50:20 2019 -0500
@@ -76,10 +76,8 @@
matches = g_regex_match(regex, v, 0, &info);
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("%s does not match the version regex"), v);
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + _("%s does not match the version regex"), v); --- a/gplugin/tests/bad-plugins/query-error.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/tests/bad-plugins/query-error.c Fri Jan 25 00:50:20 2019 -0500
@@ -20,8 +20,7 @@
G_MODULE_EXPORT GPluginPluginInfo *
gplugin_query(GPLUGIN_UNUSED GError **error) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "expected error"); --- a/gplugin/tests/dynamic-type/dynamic-type-user.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/tests/dynamic-type/dynamic-type-user.c Fri Jan 25 00:50:20 2019 -0500
@@ -42,8 +42,8 @@
test_object = g_object_new(DYNAMIC_TYPE_TEST, NULL);
if (test_object == NULL) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- "could not create an instance of DynamicTest");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + "could not create an instance of DynamicTest"); @@ -55,8 +55,8 @@
g_object_unref(test_object);
if (DYNAMIC_IS_TEST(test_object)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- "test_object is still valid");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, + "test_object is still valid"); --- a/gplugin/tests/load-on-query-fail/load-on-query-fail.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/tests/load-on-query-fail/load-on-query-fail.c Fri Jan 25 00:50:20 2019 -0500
@@ -32,7 +32,7 @@
gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "called %d times", count++);
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "called %d times", count++); --- a/gplugin/tests/plugins/load-failed.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/tests/plugins/load-failed.c Fri Jan 25 00:50:20 2019 -0500
@@ -29,8 +29,7 @@
gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "expected error"); --- a/gplugin/tests/plugins/unload-failed.c Thu Jan 24 23:45:54 2019 -0500
+++ b/gplugin/tests/plugins/unload-failed.c Fri Jan 25 00:50:20 2019 -0500
@@ -36,8 +36,7 @@
gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "expected error"); --- a/lua/gplugin-lua-loader.c Thu Jan 24 23:45:54 2019 -0500
+++ b/lua/gplugin-lua-loader.c Fri Jan 25 00:50:20 2019 -0500
@@ -39,8 +39,7 @@
msg = lua_tostring(L, -1);
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- "%s", (msg) ? msg : "Unknown");
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, (msg) ? msg : "Unknown"); @@ -112,8 +111,7 @@
if(!lua_istable(L, -1)) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "moonscript returned an unexpected value");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "moonscript returned an unexpected value"); @@ -143,8 +141,7 @@
lua_getglobal(L, "gplugin_query");
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_query function found");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "no gplugin_query function found"); --- a/python/gplugin-python-loader.c Thu Jan 24 23:45:54 2019 -0500
+++ b/python/gplugin-python-loader.c Fri Jan 25 00:50:20 2019 -0500
@@ -203,10 +203,8 @@
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("Failed to load plugin"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, + _("Failed to load plugin")); @@ -239,10 +237,8 @@
- *error = g_error_new(GPLUGIN_DOMAIN, 0,
- _("Failed to unload plugin"));
+ g_set_error_literal(error, GPLUGIN_DOMAIN, 0, + _("Failed to unload plugin")); --- a/tcc/gplugin-tcc-loader.c Thu Jan 24 23:45:54 2019 -0500
+++ b/tcc/gplugin-tcc-loader.c Fri Jan 25 00:50:20 2019 -0500
@@ -58,8 +58,7 @@
tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
if(tcc_add_file(s, filename) == -1) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "couldn't load file %s", filename);
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "couldn't load file %s", filename); @@ -68,8 +67,7 @@
/* copy code into memory */
if((memsize = tcc_relocate(s, NULL)) < 0) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "couldn't work out how much memory is needed");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "couldn't work out how much memory is needed"); @@ -77,8 +75,7 @@
memneeded = g_malloc0(memsize);
if(tcc_relocate(s, memneeded) < 0) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "could not relocate plugin into memory");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "could not relocate plugin into memory"); @@ -87,8 +84,7 @@
gplugin_query = (GPluginTccPluginQueryFunc) tcc_get_symbol(s, "gplugin_query");
if (gplugin_query == NULL) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_query function found");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "no gplugin_query function found"); @@ -123,8 +119,7 @@
gplugin_load = (GPluginTccPluginLoadFunc) tcc_get_symbol(s, "gplugin_load");
if (gplugin_load == NULL) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_load function found");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "no gplugin_load function found"); @@ -142,8 +137,7 @@
gplugin_unload = (GPluginTccPluginUnloadFunc) tcc_get_symbol(s, "gplugin_unload");
if (gplugin_unload == NULL) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "no gplugin_unload function found");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "no gplugin_unload function found"); --- a/tcc/tests/plugins/load-failed.c Thu Jan 24 23:45:54 2019 -0500
+++ b/tcc/tests/plugins/load-failed.c Fri Jan 25 00:50:20 2019 -0500
@@ -28,8 +28,7 @@
gplugin_load(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "expected error"); --- a/tcc/tests/plugins/unload-failed.c Thu Jan 24 23:45:54 2019 -0500
+++ b/tcc/tests/plugins/unload-failed.c Fri Jan 25 00:50:20 2019 -0500
@@ -35,8 +35,7 @@
gplugin_unload(GPLUGIN_UNUSED GPluginNativePlugin *plugin, GError **error) {
- *error = g_error_new(GPLUGIN_DOMAIN, 0, "expected error");
+ g_set_error(error, GPLUGIN_DOMAIN, 0, "expected error");