Prefer g_malloc over vips_malloc in vips_blob_copy (#2489)
The use of vips_malloc is not necessary here and could potentially be slower since it uses g_malloc0 (i.e. calloc).
This commit is contained in:
parent
a829a474e5
commit
8a1e1eda34
@ -659,7 +659,7 @@ vips_blob_new( VipsCallbackFn free_fn, const void *data, size_t length )
|
||||
* @length: number of bytes in @data
|
||||
*
|
||||
* Like vips_blob_new(), but take a copy of the data. Useful for bindings
|
||||
* which strugle with callbacks.
|
||||
* which struggle with callbacks.
|
||||
*
|
||||
* See also: vips_blob_new().
|
||||
*
|
||||
@ -671,7 +671,7 @@ vips_blob_copy( const void *data, size_t length )
|
||||
void *data_copy;
|
||||
VipsArea *area;
|
||||
|
||||
data_copy = vips_malloc( NULL, length );
|
||||
data_copy = g_malloc( length );
|
||||
memcpy( data_copy, data, length );
|
||||
area = vips_area_new( (VipsCallbackFn) vips_area_free_cb, data_copy );
|
||||
area->length = length;
|
||||
|
Loading…
Reference in New Issue
Block a user