Add hb_blob_copy_writable_or_fail()
New API: - hb_blob_copy_writable_or_fail()
This commit is contained in:
parent
9046e92442
commit
a989f3edec
@ -9,6 +9,7 @@ HB_EXTERN
|
|||||||
<FILE>hb-blob</FILE>
|
<FILE>hb-blob</FILE>
|
||||||
hb_blob_create
|
hb_blob_create
|
||||||
hb_blob_create_sub_blob
|
hb_blob_create_sub_blob
|
||||||
|
hb_blob_copy_writable_or_fail
|
||||||
hb_blob_destroy
|
hb_blob_destroy
|
||||||
hb_blob_get_data
|
hb_blob_get_data
|
||||||
hb_blob_get_data_writable
|
hb_blob_get_data_writable
|
||||||
|
@ -170,6 +170,31 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
|
|||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hb_blob_copy_writable_or_fail:
|
||||||
|
* @blob: A blob.
|
||||||
|
*
|
||||||
|
* Makes a writable copy of @blob.
|
||||||
|
*
|
||||||
|
* Return value: New blob, or nullptr if allocation failed.
|
||||||
|
*
|
||||||
|
* Since: 1.8.0
|
||||||
|
**/
|
||||||
|
hb_blob_t *
|
||||||
|
hb_blob_copy_writable_or_fail (hb_blob_t *blob)
|
||||||
|
{
|
||||||
|
blob = hb_blob_create (blob->data,
|
||||||
|
blob->length,
|
||||||
|
HB_MEMORY_MODE_DUPLICATE,
|
||||||
|
nullptr,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
if (unlikely (blob == hb_blob_get_empty ()))
|
||||||
|
blob = nullptr;
|
||||||
|
|
||||||
|
return blob;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hb_blob_get_empty:
|
* hb_blob_get_empty:
|
||||||
*
|
*
|
||||||
|
@ -82,6 +82,9 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
|
|||||||
unsigned int offset,
|
unsigned int offset,
|
||||||
unsigned int length);
|
unsigned int length);
|
||||||
|
|
||||||
|
HB_EXTERN hb_blob_t *
|
||||||
|
hb_blob_copy_writable_or_fail (hb_blob_t *blob);
|
||||||
|
|
||||||
HB_EXTERN hb_blob_t *
|
HB_EXTERN hb_blob_t *
|
||||||
hb_blob_get_empty (void);
|
hb_blob_get_empty (void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user