From e12863aae85dc131fcdd552edd6b32bd15702e12 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 1 Jun 2004 03:02:26 +0000 Subject: 2004-05-31 Havoc Pennington * glib/dbus-gidl.c (method_info_add_arg): keep args sorted with "in" before "out" * glib/dbus-gobject.c (dbus_type_to_string): move to dbus-gutils.c * glib/dbus-glib-tool.c (main): set up to have a --self-test option that runs the tests, and start filling in some code including for starters just dumping the interfaces to stdout * glib/Makefile.am (INCLUDES): define DBUS_LOCALEDIR * test/data/valid-introspection-files/lots-of-types.xml: test of an example introspection file * glib/dbus-gparser.c (parser_check_doctype): doctype should be "node" (I think...) --- glib/dbus-gidl.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'glib/dbus-gidl.c') diff --git a/glib/dbus-gidl.c b/glib/dbus-gidl.c index 2605df01..7db25c86 100644 --- a/glib/dbus-gidl.c +++ b/glib/dbus-gidl.c @@ -403,12 +403,33 @@ method_info_get_args (MethodInfo *info) return info->args; } +static int +args_sort_by_direction (const void *a, + const void *b) +{ + const ArgInfo *arg_a = a; + const ArgInfo *arg_b = b; + + if (arg_a->direction == arg_b->direction) + return 0; + else if (arg_a->direction == ARG_IN) + return -1; /* in is less than out */ + else + return 1; +} + void method_info_add_arg (MethodInfo *info, ArgInfo *arg) { arg_info_ref (arg); info->args = g_slist_append (info->args, arg); + + /* Keep "in" args sorted before "out" and otherwise maintain + * stable order (g_slist_sort is stable, at least in sufficiently + * new glib) + */ + info->args = g_slist_sort (info->args, args_sort_by_direction); } SignalInfo* @@ -459,8 +480,12 @@ void signal_info_add_arg (SignalInfo *info, ArgInfo *arg) { + g_assert (arg->direction == ARG_OUT); + arg_info_ref (arg); info->args = g_slist_append (info->args, arg); + + /* signal args don't need sorting since only "out" is allowed */ } ArgInfo* -- cgit