From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: [PATCH] Add some helper functions to aid language bindings

- Add constructor `soup_buffer_new_take', which is bindable and
  annotate it "Rename to: soup_buffer_new".

- Annotate `soup_message_body_append_buffer' with "Rename to:
  soup_message_body_append", as it is not bindable.


---
 libsoup/soup-message-body.c |   24 +++++++++++++++++++++++-
 libsoup/soup-message-body.h |    2 ++
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/libsoup/soup-message-body.c b/libsoup/soup-message-body.c
index f723374..a059f70 100644
--- a/libsoup/soup-message-body.c
+++ b/libsoup/soup-message-body.c
@@ -56,7 +56,7 @@ enum {
 
 /**
  * SoupBuffer:
- * @data: the data
+ * @data: (type pointer): the data
  * @length: length of @data
  *
  * A data buffer, generally used to represent a chunk of a
@@ -109,6 +109,26 @@ soup_buffer_new (SoupMemoryUse use, gconstpointer data, gsize length)
 }
 
 /**
+ * soup_buffer_new_take:
+ * @data: (array length=length) (element-type uint8) (transfer full): data
+ * @length: length of @data
+ *
+ * Creates a new #SoupBuffer containing @length bytes from @data.
+ *
+ * This function is exactly equivalent to #soup_buffer_new() with
+ * #SOUP_MEMORY_TAKE as first argument; it exists mainly for
+ * convinience and simplifying language bindings.
+ *
+ * Return value: the new #SoupBuffer.
+ * Rename to: soup_buffer_new
+ **/
+SoupBuffer *
+soup_buffer_new_take (gconstpointer data, gsize length)
+{
+	return soup_buffer_new (SOUP_MEMORY_TAKE, data, length);
+}
+
+/**
  * soup_buffer_new_subbuffer:
  * @parent: the parent #SoupBuffer
  * @offset: offset within @parent to start at
@@ -437,6 +457,8 @@ soup_message_body_append (SoupMessageBody *body, SoupMemoryUse use,
  * #SoupBuffers internally, so this is normally a constant-time
  * operation that doesn't actually require copying the data in
  * @buffer.)
+ *
+ * Rename to: soup_message_body_append
  **/
 void
 soup_message_body_append_buffer (SoupMessageBody *body, SoupBuffer *buffer)
diff --git a/libsoup/soup-message-body.h b/libsoup/soup-message-body.h
index 53a3891..7b5da0e 100644
--- a/libsoup/soup-message-body.h
+++ b/libsoup/soup-message-body.h
@@ -28,6 +28,8 @@ GType soup_buffer_get_type (void);
 SoupBuffer *soup_buffer_new            (SoupMemoryUse   use,
 					gconstpointer   data,
 					gsize           length);
+SoupBuffer *soup_buffer_new_take       (gconstpointer   data,
+					gsize           length);
 SoupBuffer *soup_buffer_new_subbuffer  (SoupBuffer     *parent,
 					gsize           offset,
 					gsize           length);
-- 
tg: (3045177..) t/binding-neatos (depends on: master t/g-i)
