diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-07-29 01:42:21 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-07-29 01:42:21 +0000 |
commit | ec9c575fb8d6d9ee2f929ad6cd70177e35ba9cd3 (patch) | |
tree | 40ce863c27d27fd80a3791d09173f670ba0030a1 /avahi-common | |
parent | 1e4fbfdf6b633cc3e3af9ba01b7baaa6994ffd38 (diff) |
DBUS: Wrap service resolver
Beef up AvahiStringList API a bit
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@189 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-common')
-rw-r--r-- | avahi-common/strlst.c | 21 | ||||
-rw-r--r-- | avahi-common/strlst.h | 6 |
2 files changed, 21 insertions, 6 deletions
diff --git a/avahi-common/strlst.c b/avahi-common/strlst.c index d962188..d8206e1 100644 --- a/avahi-common/strlst.c +++ b/avahi-common/strlst.c @@ -78,7 +78,7 @@ void avahi_string_list_free(AvahiStringList *l) { } } -static AvahiStringList* string_list_reverse(AvahiStringList *l) { +AvahiStringList* avahi_string_list_reverse(AvahiStringList *l) { AvahiStringList *r = NULL, *n; while (l) { @@ -96,7 +96,7 @@ gchar* avahi_string_list_to_string(AvahiStringList *l) { guint s = 0; gchar *t, *e; - l = string_list_reverse(l); + l = avahi_string_list_reverse(l); for (n = l; n; n = n->next) { if (n != l) @@ -120,7 +120,7 @@ gchar* avahi_string_list_to_string(AvahiStringList *l) { g_assert(e); } - l = string_list_reverse(l); + l = avahi_string_list_reverse(l); *e = 0; @@ -136,7 +136,7 @@ guint avahi_string_list_serialize(AvahiStringList *l, gpointer data, guint size) g_assert(data); - l = string_list_reverse(l); + l = avahi_string_list_reverse(l); c = data; for (n = l; n; n = n->next) { @@ -158,7 +158,7 @@ guint avahi_string_list_serialize(AvahiStringList *l, gpointer data, guint size) used += 1+ k; } - l = string_list_reverse(l); + l = avahi_string_list_reverse(l); } else { AvahiStringList *n; @@ -241,7 +241,7 @@ AvahiStringList *avahi_string_list_copy(const AvahiStringList *l) { for (; l; l = l->next) r = avahi_string_list_add_arbitrary(r, l->text, l->size); - return string_list_reverse(r); + return avahi_string_list_reverse(r); } AvahiStringList *avahi_string_list_new_from_array(const gchar *array[], gint length) { @@ -255,3 +255,12 @@ AvahiStringList *avahi_string_list_new_from_array(const gchar *array[], gint len return r; } + +guint avahi_string_list_length(const AvahiStringList *l) { + guint n = 0; + + for (; l; l = l->next) + n++; + + return n; +} diff --git a/avahi-common/strlst.h b/avahi-common/strlst.h index 85a16f4..99a9d2a 100644 --- a/avahi-common/strlst.h +++ b/avahi-common/strlst.h @@ -93,6 +93,12 @@ gboolean avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList /** Copy a string list */ AvahiStringList *avahi_string_list_copy(const AvahiStringList *l); +/** Reverse the string list. */ +AvahiStringList* avahi_string_list_reverse(AvahiStringList *l); + +/** Return the number of elements in the string list */ +guint avahi_string_list_length(const AvahiStringList *l); + AVAHI_C_DECL_END #endif |