E_NMS *nms = NULL;
static void
-dump_prop(E_NM_Property *prop)
+dump_variant(E_NM_Variant *var)
{
- if (!prop) return;
- switch (prop->type)
+ if (!var) return;
+ switch (var->type)
{
case 'a': {
- E_NM_Property *subprop;
+ E_NM_Variant *subvar;
printf("\n - ");
- ecore_list_first_goto(prop->a);
- while ((subprop = ecore_list_next(prop->a)))
- dump_prop(subprop);
+ ecore_list_first_goto(var->a);
+ while ((subvar = ecore_list_next(var->a)))
+ dump_variant(subvar);
break;
}
case 's':
case 'o':
- printf("%s ", prop->s);
+ printf("%s ", var->s);
break;
case 'u':
- printf("%d ", prop->u);
+ printf("%d ", var->u);
break;
case 'b':
- printf("%d ", prop->b);
+ printf("%d ", var->b);
break;
case 'y':
- printf("%d ", prop->y);
+ printf("%d ", var->y);
break;
case 't':
- printf("%lld ", prop->t);
+ printf("%lld ", var->t);
break;
}
}
node = value;
printf(" - name: %s - ", (char *)node->key);
- dump_prop(node->value);
+ dump_variant(node->value);
printf("\n");
}
return NULL; \
}
-static E_NM_Property *property_string(DBusMessageIter *iter, const char *sig, void *value);
-static E_NM_Property *property_basic(DBusMessageIter *iter, const char *sig, void *value);
-static E_NM_Property *property_variant(DBusMessageIter *iter, const char *sig, void *value);
-static E_NM_Property *property_array(DBusMessageIter *iter, const char *sig, void *value);
-static void property_free(E_NM_Property *prop);
+static E_NM_Variant *property_string(DBusMessageIter *iter, const char *sig, void *value);
+static E_NM_Variant *property_basic(DBusMessageIter *iter, const char *sig, void *value);
+static E_NM_Variant *property_variant(DBusMessageIter *iter, const char *sig, void *value);
+static E_NM_Variant *property_array(DBusMessageIter *iter, const char *sig, void *value);
+static void property_free(E_NM_Variant *var);
-typedef E_NM_Property *(*Property_Cb)(DBusMessageIter *iter, const char *sig, void *value);
+typedef E_NM_Variant *(*Property_Cb)(DBusMessageIter *iter, const char *sig, void *value);
typedef struct Sig_Property Sig_Property;
struct Sig_Property
return NULL;
}
-static E_NM_Property *
+static E_NM_Variant *
property_string(DBusMessageIter *iter, const char *sig, void *value)
{
- const char *str;
- E_NM_Property *prop = NULL;
+ const char *str;
+ E_NM_Variant *var = NULL;
if ((value) && (!sig))
{
if (sig)
{
if (!check_arg_type(iter, sig[0])) return NULL;
- if (!value) value = ∝
+ if (!value) value = &var;
}
else
{
- prop = malloc(sizeof(E_NM_Property));
- prop->type = dbus_message_iter_get_arg_type(iter);
- value = &prop->s;
+ var = malloc(sizeof(E_NM_Variant));
+ var->type = dbus_message_iter_get_arg_type(iter);
+ value = &var->s;
}
*((char **)value) = strdup(str);
- return prop;
+ return var;
}
-static E_NM_Property *
+static E_NM_Variant *
property_basic(DBusMessageIter *iter, const char *sig, void *value)
{
- E_NM_Property *prop = NULL;
+ E_NM_Variant *var = NULL;
if ((value) && (!sig))
{
if (!value)
{
// TODO: Only alloc right size
- prop = malloc(sizeof(long long));
- value = prop;
+ var = malloc(sizeof(long long));
+ value = var;
}
}
else
{
- prop = malloc(sizeof(E_NM_Property));
- prop->type = dbus_message_iter_get_arg_type(iter);
- value = prop;
+ var = malloc(sizeof(E_NM_Variant));
+ var->type = dbus_message_iter_get_arg_type(iter);
+ value = var;
}
dbus_message_iter_get_basic(iter, value);
- return prop;
+ return var;
}
-static E_NM_Property *
+static E_NM_Variant *
property_variant(DBusMessageIter *iter, const char *sig, void *value)
{
DBusMessageIter v_iter;
return (*func)(&v_iter, NULL, NULL);
}
-static E_NM_Property *
+static E_NM_Variant *
property_array(DBusMessageIter *iter, const char *sig, void *value)
{
DBusMessageIter a_iter;
Ecore_List **list;
Property_Cb func;
- E_NM_Property *prop = NULL;
+ E_NM_Variant *var = NULL;
const char *subsig = NULL;
if ((value) && (!sig))
subsig = (sig + 1);
func = find_property_cb(subsig);
if (!func) return NULL;
- if (!value) value = ∝
+ if (!value) value = &var;
list = (Ecore_List **)value;
*list = ecore_list_new();
if (subsig[0] == 'a')
char tmp[] = { dbus_message_iter_get_arg_type(&a_iter), 0 };
func = find_property_cb(tmp);
if (!func) return NULL;
- prop = malloc(sizeof(E_NM_Property));
- prop->type = dbus_message_iter_get_arg_type(iter);
- list = (Ecore_List **)&prop->a;
+ var = malloc(sizeof(E_NM_Variant));
+ var->type = dbus_message_iter_get_arg_type(iter);
+ list = (Ecore_List **)&var->a;
*list = ecore_list_new();
ecore_list_free_cb_set(*list, ECORE_FREE_CB(property_free));
}
while (dbus_message_iter_get_arg_type(&a_iter) != DBUS_TYPE_INVALID)
{
- void *subprop;
+ void *subvar;
- subprop = (*func)(&a_iter, subsig, NULL);
- if (subprop) ecore_list_append(*list, subprop);
+ subvar = (*func)(&a_iter, subsig, NULL);
+ if (subvar) ecore_list_append(*list, subvar);
dbus_message_iter_next(&a_iter);
}
- return prop;
+ return var;
}
static void
-property_free(E_NM_Property *prop)
+property_free(E_NM_Variant *var)
{
- if (!prop) return;
- if ((prop->type == 's') || (prop->type == 'o'))
- free(prop->s);
- else if (prop->type == 'a')
- ecore_list_destroy(prop->a);
- free(prop);
+ if (!var) return;
+ if ((var->type == 's') || (var->type == 'o'))
+ free(var->s);
+ else if (var->type == 'a')
+ ecore_list_destroy(var->a);
+ free(var);
}
void
while (dbus_message_iter_get_arg_type(&a_iter) != DBUS_TYPE_INVALID)
{
DBusMessageIter d_iter, a2_iter;
- E_NM_Property *prop;
+ E_NM_Variant *prop;
const char *name;
Ecore_Hash *value;