Creates a new Buffer containing data.length bytes from data.
When the Buffer is freed, it will call owner_dnotify, passing owner
to it. You must ensure that data will remain valid until owner_dnotify is called.
For example, you could use this to create a buffer containing data returned from libxml without needing to do an extra copy:
<informalexample><programlisting> xmlDocDumpMemory (doc, &xmlbody, &len); return soup_buffer_new_with_owner (xmlbody, len, xmlbody, (GDestroyNotify)xmlFree); </programlisting></informalexample>
In this example, data and owner are the same, but in other cases they would be different (eg, owner
would be a object, and data would be a pointer to one of the object's fields).
| data |
data |
| owner |
pointer to an object that owns |
| owner_dnotify |
a function to free/unref |
| length |
length of |
|
the new Buffer. |