Commit 5efd13e3 authored by Torsten Schönfeld's avatar Torsten Schönfeld

Harmonize indentation

parent 565e78c4
......@@ -29,16 +29,16 @@ store_fields (HV *fields, GIBaseInfo *info, GIInfoType info_type)
case GI_INFO_TYPE_UNION:
{
gint n_fields = g_union_info_get_n_fields ((GIUnionInfo *) info);
for (i = 0; i < n_fields; i++) {
GIFieldInfo *field_info;
const gchar *field_name;
field_info = g_union_info_get_field ((GIUnionInfo *) info, i);
field_name = g_base_info_get_name ((GIBaseInfo *) field_info);
av_push (av, newSVpv (field_name, PL_na));
g_base_info_unref ((GIBaseInfo *) field_info);
}
break;
gint n_fields = g_union_info_get_n_fields ((GIUnionInfo *) info);
for (i = 0; i < n_fields; i++) {
GIFieldInfo *field_info;
const gchar *field_name;
field_info = g_union_info_get_field ((GIUnionInfo *) info, i);
field_name = g_base_info_get_name ((GIBaseInfo *) field_info);
av_push (av, newSVpv (field_name, PL_na));
g_base_info_unref ((GIBaseInfo *) field_info);
}
break;
}
default:
......
......@@ -35,10 +35,10 @@ get_function_info (GIRepository *repository,
method);
break;
case GI_INFO_TYPE_UNION:
function_info = g_union_info_find_method (
(GIUnionInfo *) namespace_info,
method);
break;
function_info = g_union_info_find_method (
(GIUnionInfo *) namespace_info,
method);
break;
default:
ccroak ("Base info for namespace %s has incorrect type",
namespace);
......
......@@ -88,7 +88,7 @@ sv_to_arg (SV * sv,
break;
case GI_TYPE_TAG_ARRAY:
arg->v_pointer = sv_to_array (transfer, type_info, sv, invocation_info);
arg->v_pointer = sv_to_array (transfer, type_info, sv, invocation_info);
break;
case GI_TYPE_TAG_INTERFACE:
......@@ -103,7 +103,7 @@ sv_to_arg (SV * sv,
break;
case GI_TYPE_TAG_GHASH:
arg->v_pointer = sv_to_ghash (transfer, type_info, sv);
arg->v_pointer = sv_to_ghash (transfer, type_info, sv);
break;
case GI_TYPE_TAG_ERROR:
......@@ -218,7 +218,7 @@ arg_to_sv (GIArgument * arg,
return glist_to_sv (info, arg->v_pointer, transfer);
case GI_TYPE_TAG_GHASH:
return ghash_to_sv (info, arg->v_pointer, transfer);
return ghash_to_sv (info, arg->v_pointer, transfer);
case GI_TYPE_TAG_ERROR:
ccroak ("FIXME - GI_TYPE_TAG_ERROR");
......
......@@ -40,13 +40,13 @@ array_to_sv (GITypeInfo *info,
if (is_zero_terminated) {
length = g_strv_length (pointer);
} else {
length = g_type_info_get_array_fixed_size (info);
if (length < 0) {
length = g_type_info_get_array_fixed_size (info);
if (length < 0) {
guint length_pos = g_type_info_get_array_length (info);
g_assert (iinfo && iinfo->aux_args);
/* FIXME: Is it OK to always use v_size here? */
length = iinfo->aux_args[length_pos].v_size;
}
}
}
if (length < 0) {
......@@ -120,9 +120,9 @@ sv_to_array (GITransfer transfer,
av = (AV *) SvRV (sv);
item_transfer = transfer == GI_TRANSFER_CONTAINER
? GI_TRANSFER_NOTHING
: transfer;
item_transfer = transfer == GI_TRANSFER_CONTAINER
? GI_TRANSFER_NOTHING
: transfer;
param_info = g_type_info_get_param_type (type_info, 0);
param_tag = g_type_info_get_tag (param_info);
......@@ -131,10 +131,10 @@ sv_to_array (GITransfer transfer,
g_type_tag_to_string (g_type_info_get_tag (param_info)),
transfer);
is_zero_terminated = g_type_info_is_zero_terminated (type_info);
item_size = size_of_type_info (param_info);
is_zero_terminated = g_type_info_is_zero_terminated (type_info);
item_size = size_of_type_info (param_info);
length = av_len (av) + 1;
array = g_array_sized_new (is_zero_terminated, FALSE, item_size, length);
array = g_array_sized_new (is_zero_terminated, FALSE, item_size, length);
/* Arrays containing non-basic types as non-pointers need to be treated
* specially. Prime example: GValue *values = g_new0 (GValue, n);
......@@ -155,7 +155,7 @@ sv_to_array (GITransfer transfer,
sv_to_arg (*svp, &arg, NULL, param_info,
item_transfer, TRUE, NULL);
if (need_struct_value_semantics) {
if (need_struct_value_semantics) {
/* Copy from the memory area pointed to by
* arg.v_pointer. */
g_array_insert_vals (array, i, arg.v_pointer, 1);
......
......@@ -9,9 +9,9 @@ ghash_to_sv (GITypeInfo *info,
{
GITypeInfo *key_param_info, *value_param_info;
#ifdef NOISY
GITypeTag key_type_tag, value_type_tag;
GITypeTag key_type_tag, value_type_tag;
#endif
gpointer key_p, value_p;
gpointer key_p, value_p;
GITransfer item_transfer;
GHashTableIter iter;
HV *hv;
......@@ -21,30 +21,30 @@ ghash_to_sv (GITypeInfo *info,
}
item_transfer = transfer == GI_TRANSFER_EVERYTHING
? GI_TRANSFER_EVERYTHING
: GI_TRANSFER_NOTHING;
? GI_TRANSFER_EVERYTHING
: GI_TRANSFER_NOTHING;
key_param_info = g_type_info_get_param_type (info, 0);
value_param_info = g_type_info_get_param_type (info, 1);
value_param_info = g_type_info_get_param_type (info, 1);
#ifdef NOISY
key_type_tag = g_type_info_get_tag (key_param_info);
value_type_tag = g_type_info_get_tag (value_param_info);
key_type_tag = g_type_info_get_tag (key_param_info);
value_type_tag = g_type_info_get_tag (value_param_info);
#endif
dwarn (" GHashTable: pointer %p\n"
" key type tag %d (%s)\n"
" value type tag %d (%s)\n",
" key type tag %d (%s)\n"
" value type tag %d (%s)\n",
pointer,
key_type_tag, g_type_tag_to_string (key_type_tag),
value_type_tag, g_type_tag_to_string (value_type_tag));
hv = newHV ();
g_hash_table_iter_init (&iter, pointer);
while (g_hash_table_iter_next (&iter, &key_p, &value_p)) {
g_hash_table_iter_init (&iter, pointer);
while (g_hash_table_iter_next (&iter, &key_p, &value_p)) {
GIArgument arg = { 0, };
SV *key_sv, *value_sv;
SV *key_sv, *value_sv;
dwarn (" converting key pointer %p\n", key_p);
arg.v_pointer = key_p;
......@@ -52,17 +52,17 @@ ghash_to_sv (GITypeInfo *info,
if (key_sv == NULL)
break;
dwarn (" converting value pointer %p\n", value_p);
arg.v_pointer = value_p;
value_sv = arg_to_sv (&arg, value_param_info, item_transfer, NULL);
if (value_sv == NULL)
break;
dwarn (" converting value pointer %p\n", value_p);
arg.v_pointer = value_p;
value_sv = arg_to_sv (&arg, value_param_info, item_transfer, NULL);
if (value_sv == NULL)
break;
(void) hv_store_ent (hv, key_sv, value_sv, 0);
(void) hv_store_ent (hv, key_sv, value_sv, 0);
}
g_base_info_unref ((GIBaseInfo *) key_param_info);
g_base_info_unref ((GIBaseInfo *) value_param_info);
g_base_info_unref ((GIBaseInfo *) value_param_info);
return newRV_noinc ((SV *) hv);
}
......@@ -73,14 +73,14 @@ sv_to_ghash (GITransfer transfer,
SV *sv)
{
HV *hv;
HE *he;
HE *he;
GITransfer item_transfer;
gpointer hash;
GITypeInfo *key_param_info, *value_param_info;
GITypeTag key_type_tag;
GHashFunc hash_func;
GEqualFunc equal_func;
I32 n_keys;
GITypeTag key_type_tag;
GHashFunc hash_func;
GEqualFunc equal_func;
I32 n_keys;
dwarn ("%s: sv %p\n", G_STRFUNC, sv);
......@@ -106,28 +106,27 @@ sv_to_ghash (GITransfer transfer,
}
key_param_info = g_type_info_get_param_type (type_info, 0);
value_param_info = g_type_info_get_param_type (type_info, 1);
value_param_info = g_type_info_get_param_type (type_info, 1);
key_type_tag = g_type_info_get_tag (key_param_info);
key_type_tag = g_type_info_get_tag (key_param_info);
switch (key_type_tag)
{
case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_UTF8:
hash_func = g_str_hash;
equal_func = g_str_equal;
break;
switch (key_type_tag) {
case GI_TYPE_TAG_FILENAME:
case GI_TYPE_TAG_UTF8:
hash_func = g_str_hash;
equal_func = g_str_equal;
break;
default:
hash_func = NULL;
equal_func = NULL;
break;
}
default:
hash_func = NULL;
equal_func = NULL;
break;
}
dwarn (" GHashTable with transfer %d\n"
" key_param_info %p with type tag %d (%s)\n"
" value_param_info %p with type tag %d (%s)\n",
transfer,
" key_param_info %p with type tag %d (%s)\n"
" value_param_info %p with type tag %d (%s)\n",
transfer,
key_param_info,
g_type_info_get_tag (key_param_info),
g_type_tag_to_string (g_type_info_get_tag (key_param_info)),
......@@ -135,44 +134,44 @@ sv_to_ghash (GITransfer transfer,
g_type_info_get_tag (value_param_info),
g_type_tag_to_string (g_type_info_get_tag (value_param_info)));
hash = g_hash_table_new (hash_func, equal_func);
hash = g_hash_table_new (hash_func, equal_func);
n_keys = hv_iterinit (hv);
if (n_keys == 0)
goto out;
n_keys = hv_iterinit (hv);
if (n_keys == 0)
goto out;
while ((he = hv_iternext (hv)) != NULL) {
SV *sv;
GIArgument arg = { 0, };
gpointer key_p, value_p;
while ((he = hv_iternext (hv)) != NULL) {
SV *sv;
GIArgument arg = { 0, };
gpointer key_p, value_p;
key_p = value_p = NULL;
key_p = value_p = NULL;
sv = hv_iterkeysv (he);
sv = hv_iterkeysv (he);
if (sv && gperl_sv_is_defined (sv)) {
dwarn (" converting key SV %p\n", sv);
/* FIXME: Is it OK to always allow undef here? */
sv_to_arg (sv, &arg, NULL, key_param_info,
item_transfer, TRUE, NULL);
key_p = arg.v_pointer;
key_p = arg.v_pointer;
}
sv = hv_iterval (hv, he);
if (sv && gperl_sv_is_defined (sv)) {
dwarn (" converting value SV %p\n", sv);
sv_to_arg (sv, &arg, NULL, key_param_info,
item_transfer, TRUE, NULL);
value_p = arg.v_pointer;
}
sv = hv_iterval (hv, he);
if (sv && gperl_sv_is_defined (sv)) {
dwarn (" converting value SV %p\n", sv);
sv_to_arg (sv, &arg, NULL, key_param_info,
item_transfer, TRUE, NULL);
value_p = arg.v_pointer;
}
if (key_p != NULL && value_p != NULL)
g_hash_table_insert (hash, key_p, value_p);
if (key_p != NULL && value_p != NULL)
g_hash_table_insert (hash, key_p, value_p);
}
out:
dwarn (" -> hash %p of size %d\n", hash, g_hash_table_size (hash));
g_base_info_unref ((GIBaseInfo *) key_param_info);
g_base_info_unref ((GIBaseInfo *) key_param_info);
g_base_info_unref ((GIBaseInfo *) value_param_info);
return hash;
......
......@@ -74,7 +74,7 @@ instance_pointer_to_sv (GICallableInfo *info, gpointer pointer)
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_UNION:
case GI_INFO_TYPE_UNION:
{
GType type = get_gtype ((GIRegisteredTypeInfo *) container);
if (!type || type == G_TYPE_NONE) {
......
......@@ -112,8 +112,8 @@ sv_to_glist (GITransfer transfer, GITypeInfo * type_info, SV * sv, GPerlI11nInvo
/* FIXME: Is it OK to always allow undef here? */
sv_to_arg (*svp, &arg, NULL, param_info,
item_transfer, TRUE, NULL);
/* ENHANCEME: Could use g_[s]list_prepend and
* later _reverse for efficiency. */
/* ENHANCEME: Could use g_[s]list_prepend and
* later _reverse for efficiency. */
if (is_slist)
list = g_slist_append (list, arg.v_pointer);
else
......
......@@ -43,7 +43,7 @@ store_methods (HV *namespaced_functions, GIBaseInfo *info, GIInfoType info_type)
case GI_INFO_TYPE_UNION:
{
PUSH_METHODS (union, av, info);
break;
break;
}
default:
......
......@@ -26,8 +26,8 @@ size_of_type_tag (GITypeTag type_tag)
return sizeof (gdouble);
case GI_TYPE_TAG_GTYPE:
return sizeof (GType);
case GI_TYPE_TAG_UNICHAR:
return sizeof (gunichar);
case GI_TYPE_TAG_UNICHAR:
return sizeof (gunichar);
case GI_TYPE_TAG_VOID:
case GI_TYPE_TAG_UTF8:
......@@ -38,9 +38,9 @@ size_of_type_tag (GITypeTag type_tag)
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_ERROR:
ccroak ("Unable to determine the size of '%s'",
g_type_tag_to_string (type_tag));
break;
ccroak ("Unable to determine the size of '%s'",
g_type_tag_to_string (type_tag));
break;
}
return 0;
......@@ -129,7 +129,7 @@ size_of_type_info (GITypeInfo *type_info)
case GI_TYPE_TAG_FLOAT:
case GI_TYPE_TAG_DOUBLE:
case GI_TYPE_TAG_GTYPE:
case GI_TYPE_TAG_UNICHAR:
case GI_TYPE_TAG_UNICHAR:
if (g_type_info_is_pointer (type_info)) {
return sizeof (gpointer);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment