[libpeas] Reformat some parts of the Seed loader
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Reformat some parts of the Seed loader
- Date: Thu, 24 Mar 2011 23:06:11 +0000 (UTC)
commit 0aaa9e4156b7604c6ccacfe7081fe6a2139849b0
Author: Garrett Regier <alias301 gmail com>
Date: Fri Mar 18 09:16:49 2011 -0700
Reformat some parts of the Seed loader
loaders/seed/peas-extension-seed.c | 35 ++++++++++++++++---------------
loaders/seed/peas-plugin-loader-seed.c | 30 +++++++++++++-------------
2 files changed, 33 insertions(+), 32 deletions(-)
---
diff --git a/loaders/seed/peas-extension-seed.c b/loaders/seed/peas-extension-seed.c
index 450be5d..700805b 100644
--- a/loaders/seed/peas-extension-seed.c
+++ b/loaders/seed/peas-extension-seed.c
@@ -150,9 +150,9 @@ peas_extension_seed_dispose (GObject *object)
}
static SeedValue
-get_argument (SeedContext ctx,
- GIArgument *arg,
- GITypeInfo *arg_type_info,
+get_argument (SeedContext ctx,
+ GIArgument *arg,
+ GITypeInfo *arg_type_info,
SeedException *exc)
{
/* Notes: According to GCC 4.4,
@@ -220,9 +220,11 @@ set_return_value (OutArg *arg,
SeedValue value,
SeedException *exc)
{
- g_debug (G_STRFUNC);
switch (g_type_info_get_tag (&arg->type_info))
{
+ case GI_TYPE_TAG_VOID:
+ g_assert_not_reached ();
+ break;
case GI_TYPE_TAG_BOOLEAN:
*((gboolean *) arg->ptr) = seed_value_to_boolean (ctx, value, exc);
break;
@@ -389,21 +391,20 @@ peas_extension_seed_call (PeasExtension *exten,
if (exc != NULL)
goto cleanup;
- switch (n_out_args)
+ if (n_out_args == 1)
{
- case 0:
- break;
- case 1:
set_return_value (&out_args[0], sexten->js_context, js_ret, exc);
- break;
- default:
- if (seed_value_is_object (sexten->js_context, js_ret))
- for (i = 0; i < n_out_args && exc == NULL; i++)
- {
- val = seed_object_get_property_at_index (sexten->js_context, js_ret, i, exc);
- if (exc == NULL)
- set_return_value (&out_args[i], sexten->js_context, val, exc);
- }
+ }
+ else if (n_out_args > 0 && seed_value_is_object (sexten->js_context, js_ret))
+ {
+ for (i = 0; i < n_out_args && exc == NULL; i++)
+ {
+ val = seed_object_get_property_at_index (sexten->js_context, js_ret,
+ i, exc);
+
+ if (exc == NULL)
+ set_return_value (&out_args[i], sexten->js_context, val, exc);
+ }
}
cleanup:
diff --git a/loaders/seed/peas-plugin-loader-seed.c b/loaders/seed/peas-plugin-loader-seed.c
index ed393bf..0187db4 100644
--- a/loaders/seed/peas-plugin-loader-seed.c
+++ b/loaders/seed/peas-plugin-loader-seed.c
@@ -89,21 +89,19 @@ peas_plugin_loader_seed_load (PeasPluginLoader *loader,
seed_context_unref (context);
return FALSE;
}
- else
- {
- global = seed_context_get_global_object (context);
- extensions = seed_object_get_property (context, global, "extensions");
- if (seed_value_is_object (context, extensions))
- {
- sinfo = (SeedInfo *) g_slice_new (SeedInfo);
- sinfo->context = context;
- sinfo->extensions = extensions;
- seed_context_ref (context);
- seed_value_protect (context, extensions);
+ global = seed_context_get_global_object (context);
+ extensions = seed_object_get_property (context, global, "extensions");
- g_hash_table_insert (sloader->loaded_plugins, info, sinfo);
- }
+ if (seed_value_is_object (context, extensions))
+ {
+ sinfo = (SeedInfo *) g_slice_new (SeedInfo);
+ sinfo->context = context;
+ sinfo->extensions = extensions;
+ seed_context_ref (context);
+ seed_value_protect (context, extensions);
+
+ g_hash_table_insert (sloader->loaded_plugins, info, sinfo);
}
seed_context_unref (context);
@@ -188,8 +186,10 @@ peas_plugin_loader_seed_create_extension (PeasPluginLoader *loader,
* conventional '-', to make them accessible through this.property_name */
key = g_strdup (parameters[i].name);
for (j = 0; key[j] != '\0'; j++)
- if (key[j] == '-')
- key[j] = '_';
+ {
+ if (key[j] == '-')
+ key[j] = '_';
+ }
value = seed_value_from_gvalue (sinfo->context,
¶meters[i].value,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]