summaryrefslogtreecommitdiffstats
path: root/avahi-common
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-08-09 00:32:32 +0000
committerLennart Poettering <lennart@poettering.net>2005-08-09 00:32:32 +0000
commitaa458a0a13d18882354f33c07b0a4e8e82e7a424 (patch)
treefe2798a3f057d2ef9e177a183afec43e973c28a5 /avahi-common
parent707e763398063186c20d8aba3abdef20e3d39253 (diff)
* Update HACKING
* Change DBUS API: txt record lists are now coded as "aay" instead of "as". Unfortunately this triggers this bug: https://bugs.freedesktop.org/show_bug.cgi?id=4023 If you want to use avahi-publish-service you need to apply the included patch. * change avahi-bookmarks to listen on 127.0.0.1 only * add ftp and https browsing support to avahi-bookmarks, but disable it due to python-dbus bugs * update avahi module for python to provide functions to convert between tring lists and lists of lists of bytes * add avahi_strlst_add_anonymous() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@281 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-common')
-rw-r--r--avahi-common/strlst.c17
-rw-r--r--avahi-common/strlst.h10
2 files changed, 23 insertions, 4 deletions
diff --git a/avahi-common/strlst.c b/avahi-common/strlst.c
index d4d67da..46ed852 100644
--- a/avahi-common/strlst.c
+++ b/avahi-common/strlst.c
@@ -28,14 +28,25 @@
#include "strlst.h"
+AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, guint size) {
+ AvahiStringList *n;
+
+ n = g_malloc(sizeof(AvahiStringList) + size);
+ n->next = l;
+ n->size = size;
+
+ return n;
+}
+
AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const guint8*text, guint size) {
AvahiStringList *n;
g_assert(text);
- n = g_malloc(sizeof(AvahiStringList) + size);
- n->next = l;
- memcpy(n->text, text, n->size = size);
+ n = avahi_string_list_add_anonymous(l, size);
+
+ if (size > 0)
+ memcpy(n->text, text, size);
return n;
}
diff --git a/avahi-common/strlst.h b/avahi-common/strlst.h
index 99a9d2a..a4a4202 100644
--- a/avahi-common/strlst.h
+++ b/avahi-common/strlst.h
@@ -62,10 +62,17 @@ void avahi_string_list_free(AvahiStringList *l);
* start. */
AvahiStringList *avahi_string_list_add(AvahiStringList *l, const gchar *text);
-/** Append am arbitrary length byte string to the list. Returns the
+/** Append an arbitrary length byte string to the list. Returns the
* new list start. */
AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const guint8 *text, guint size);
+/** Append a new entry to the string list. The string is not filled
+with data. The caller should fill in string data afterwards by writing
+it to l->text, where l is the pointer returned by this function. This
+function exists solely to optimize a few operations where otherwise
+superfluous string copying would be necessary. */
+AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, guint size);
+
/** Same as avahi_string_list_add(), but takes a variable number of
* NUL terminated strings. The argument list must be terminated by a
* NULL pointer. Returns the new list start. */
@@ -99,6 +106,7 @@ 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