From 0bc346c97973c9f7fb13cfd7c6c3c86f557e61d2 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 12 Nov 2012 16:07:01 +0000 Subject: [PATCH] edbus: move function up - no fwd declaration when not needed SVN revision: 79177 --- legacy/edbus/src/lib/edbus_service.c | 57 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/legacy/edbus/src/lib/edbus_service.c b/legacy/edbus/src/lib/edbus_service.c index 109ef602d5..33ce0cc49f 100644 --- a/legacy/edbus/src/lib/edbus_service.c +++ b/legacy/edbus/src/lib/edbus_service.c @@ -52,7 +52,6 @@ static DBusHandlerResult _object_handler(DBusConnection *conn, DBusMessage *mess static void _object_free(EDBus_Service_Object *obj); static void _interface_free(EDBus_Service_Interface *interface); static void _on_connection_free(void *data, const void *dead_pointer); -static EDBus_Service_Object *_edbus_service_object_parent_find(EDBus_Service_Object *obj); static DBusObjectPathVTable vtable = { _object_unregister, @@ -487,6 +486,34 @@ edbus_service_shutdown(void) _default_interfaces_free(); } +static EDBus_Service_Object * +_edbus_service_object_parent_find(EDBus_Service_Object *obj) +{ + size_t len = strlen(obj->path); + char *path = strdup(obj->path); + char *slash; + + for (slash = path[len] != '/' ? &path[len - 1] : &path[len - 2]; + slash > path; slash--) + { + EDBus_Service_Object *parent = NULL; + + if (*slash != '/') + continue; + + *slash = '\0'; + + if (dbus_connection_get_object_path_data(obj->conn->dbus_conn, path,(void **)&parent) && parent != NULL) + { + free(path); + return parent; + } + } + + free(path); + return NULL; +} + static EDBus_Service_Object * _edbus_service_object_add(EDBus_Connection *conn, const char *path) { @@ -1092,31 +1119,3 @@ edbus_service_property_invalidate_set(EDBus_Service_Interface *iface, const char iface->prop_invalidated = eina_array_new(1); return eina_array_push(iface->prop_invalidated, prop); } - -static EDBus_Service_Object * -_edbus_service_object_parent_find(EDBus_Service_Object *obj) -{ - size_t len = strlen(obj->path); - char *path = strdup(obj->path); - char *slash; - - for (slash = path[len] != '/' ? &path[len - 1] : &path[len - 2]; - slash > path; slash--) - { - EDBus_Service_Object *parent = NULL; - - if (*slash != '/') - continue; - - *slash = '\0'; - - if (dbus_connection_get_object_path_data(obj->conn->dbus_conn, path,(void **)&parent) && parent != NULL) - { - free(path); - return parent; - } - } - - free(path); - return NULL; -}