summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-list.c29
-rw-r--r--dbus/dbus-list.h2
-rw-r--r--dbus/dbus-protocol.h31
3 files changed, 52 insertions, 10 deletions
diff --git a/dbus/dbus-list.c b/dbus/dbus-list.c
index 546da5cd..e71a7c4a 100644
--- a/dbus/dbus-list.c
+++ b/dbus/dbus-list.c
@@ -341,6 +341,7 @@ _dbus_list_remove_last (DBusList **list,
DBusList *link;
link = _dbus_list_get_last_link (list);
+
while (link != NULL)
{
if (link->data == data)
@@ -884,10 +885,22 @@ _dbus_list_test (void)
link1 = _dbus_list_get_next_link (&list1, link1);
++i;
}
-
+
+ --i;
+ link1 = _dbus_list_get_last_link (&list1);
+ while (link1 != NULL)
+ {
+ verify_list (&link1); /* pretend this link is the head */
+
+ _dbus_assert (_DBUS_POINTER_TO_INT (link1->data) == i);
+
+ link1 = _dbus_list_get_prev_link (&list1, link1);
+ --i;
+ }
+
_dbus_list_clear (&list1);
_dbus_list_clear (&list2);
-
+
/* Test remove */
i = 0;
@@ -1106,6 +1119,18 @@ _dbus_list_test (void)
_dbus_list_clear (&list1);
+ /* using remove_last */
+ _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (2));
+ _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (1));
+ _dbus_list_append (&list1, _DBUS_INT_TO_POINTER (3));
+
+ _dbus_list_remove_last (&list1, _DBUS_INT_TO_POINTER (2));
+
+ verify_list (&list1);
+ _dbus_assert (is_ascending_sequence (&list1));
+
+ _dbus_list_clear (&list1);
+
return TRUE;
}
diff --git a/dbus/dbus-list.h b/dbus/dbus-list.h
index ce8956a4..d1e3b741 100644
--- a/dbus/dbus-list.h
+++ b/dbus/dbus-list.h
@@ -71,7 +71,7 @@ void _dbus_list_foreach (DBusList **list,
void *data);
#define _dbus_list_get_next_link(list, link) ((link)->next == *(list) ? NULL : (link)->next)
-#define _dbus_list_get_prev_link(list, link) ((link)->prev == *(list) ? NULL : (link)->prev)
+#define _dbus_list_get_prev_link(list, link) ((link) == *(list) ? NULL : (link)->prev)
DBUS_END_DECLS;
diff --git a/dbus/dbus-protocol.h b/dbus/dbus-protocol.h
index fe397f41..774ccf2c 100644
--- a/dbus/dbus-protocol.h
+++ b/dbus/dbus-protocol.h
@@ -1,7 +1,7 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-protocol.h D-Bus protocol constants
*
- * Copyright (C) 2002 CodeFactory AB
+ * Copyright (C) 2002, 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 1.2
*
@@ -59,14 +59,31 @@ extern "C" {
/* Services */
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
#define DBUS_SERVICE_BROADCAST "org.freedesktop.DBus.Broadcast"
+
+/* Service owner flags */
+#define DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT 0x1
+#define DBUS_SERVICE_FLAG_REPLACE_EXISTING 0x2
+
+/* Service replies */
+#define DBUS_SERVICE_REPLY_PRIMARY_OWNER 0x1
+#define DBUS_SERVICE_REPLY_IN_QUEUE 0x2
+#define DBUS_SERVICE_REPLY_SERVICE_EXISTS 0x3
+#define DBUS_SERVICE_REPLY_ALREADY_OWNER 0x4
/* Messages */
-#define DBUS_MESSAGE_HELLO "org.freedesktop.DBus.Hello"
-#define DBUS_MESSAGE_LIST_SERVICES "org.freedesktop.DBus.ListServices"
-#define DBUS_MESSAGE_SERVICE_CREATED "org.freedesktop.DBus.ServiceCreated"
-#define DBUS_MESSAGE_SERVICE_DELETED "org.freedesktop.DBus.ServiceDeleted"
-#define DBUS_MESSAGE_SERVICES "org.freedesktop.DBus.Services"
-#define DBUS_MESSAGE_WELCOME "org.freedesktop.DBus.Welcome"
+#define DBUS_MESSAGE_SERVICE_EXISTS "org.freedesktop.DBus.ServiceExists"
+#define DBUS_MESSAGE_SERVICE_EXISTS_REPLY "org.freedesktop.DBus.ServiceExists:Reply"
+#define DBUS_MESSAGE_HELLO "org.freedesktop.DBus.Hello"
+#define DBUS_MESSAGE_HELLO_REPLY "org.freedesktop.DBus.Hello:Reply"
+#define DBUS_MESSAGE_LIST_SERVICES "org.freedesktop.DBus.ListServices"
+#define DBUS_MESSAGE_LIST_SERVICES_REPLY "org.freedesktop.DBus.ListServices:Reply"
+#define DBUS_MESSAGE_ACQUIRE_SERVICE "org.freedesktop.DBus.OwnService"
+#define DBUS_MESSAGE_ACQUIRE_SERVICE_REPLY "org.freedesktop.DBus.OwnService:Reply"
+#define DBUS_MESSAGE_SERVICE_ACQUIRED "org.freedesktop.DBus.ServiceAcquired"
+#define DBUS_MESSAGE_SERVICE_CREATED "org.freedesktop.DBus.ServiceCreated"
+#define DBUS_MESSAGE_SERVICE_DELETED "org.freedesktop.DBus.ServiceDeleted"
+#define DBUS_MESSAGE_SERVICE_LOST "org.freedesktop.DBus.ServiceLost"
+
#ifdef __cplusplus
}