From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: 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".

- Likewise, create `soup_message_body_append_take' and "Rename to:
  soup_message_body_append".

See <https://bugzilla.gnome.org/show_bug.cgi?id=576595>.

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

diff --git a/libsoup/soup-message-body.c b/libsoup/soup-message-body.c
index f723374..0d798f5 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,28 @@ soup_buffer_new (SoupMemoryUse use, gconstpointer data, gsize length)
 }
 
 /**
+ * soup_buffer_new_take:
+ * @data: (array length=length) (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
+ * convenience and simplifying language bindings.
+ *
+ * Return value: the new #SoupBuffer.
+ *
+ * Since: 2.32
+ * Rename to: soup_buffer_new
+ **/
+SoupBuffer *
+soup_buffer_new_take (guchar *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
@@ -429,6 +451,28 @@ soup_message_body_append (SoupMessageBody *body, SoupMemoryUse use,
 }
 
 /**
+ * soup_message_body_append_take:
+ * @body: a #SoupMessageBody
+ * @data: (array length=length) (transfer full): data to append
+ * @length: length of @data
+ *
+ * Appends @length bytes from @data to @body.
+ *
+ * This function is exactly equivalent to soup_message_body_apppend()
+ * with %SOUP_MEMORY_TAKE as second argument; it exists mainly for
+ * convenience and simplifying language bindings.
+ *
+ * Since: 2.32
+ * Rename to: soup_message_body_append
+ **/
+void
+soup_message_body_append_take (SoupMessageBody *body,
+			       guchar *data, gsize length)
+{
+	soup_message_body_append(body, SOUP_MEMORY_TAKE, data, length);
+}
+
+/**
  * soup_message_body_append_buffer:
  * @body: a #SoupMessageBody
  * @buffer: a #SoupBuffer
diff --git a/libsoup/soup-message-body.h b/libsoup/soup-message-body.h
index 53a3891..f21c570 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       (guchar         *data,
+					gsize           length);
 SoupBuffer *soup_buffer_new_subbuffer  (SoupBuffer     *parent,
 					gsize           offset,
 					gsize           length);
@@ -59,6 +61,9 @@ void             soup_message_body_append        (SoupMessageBody *body,
 						  SoupMemoryUse    use,
 						  gconstpointer    data,
 						  gsize            length);
+void             soup_message_body_append_take   (SoupMessageBody *body,
+						  guchar          *data,
+						  gsize            length);
 void             soup_message_body_append_buffer (SoupMessageBody *body,
 						  SoupBuffer      *buffer);
 void             soup_message_body_truncate      (SoupMessageBody *body);
-- 
tg: (28c649f..) t/binding-neatos (depends on: master t/g-i)
