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:
Kleis Auke Wolthuizen 2021-10-20 15:22:00 +02:00 committed by GitHub
parent a829a474e5
commit 8a1e1eda34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;