view man/mlk_alloc_new.3 @ 483:6c06c82d276a

misc: objects can no longer be transformed to action/drawable It is not convenient if the user wants to provide its own variant of a function as it will be unable to use its own data and the underlying data as well.
author David Demelier <markand@malikania.fr>
date Mon, 27 Feb 2023 18:19:38 +0100
parents 9c3b3935f0aa
children
line wrap: on
line source

.Dd $Mdocdate$
.Dt MLK_ALLOC_NEW 3
.Os
.Sh NAME
.Nm mlk_alloc_new ,
.Nm mlk_alloc_new0 ,
.Nm mlk_alloc_renew ,
.Nm mlk_alloc_renew0
.Nd allocate memory
.Sh LIBRARY
libmlk-core (-lmlk-core)
.Sh SYNOPSIS
.In mlk/core/alloc.h
.Ft void *
.Fn mlk_alloc_new "size_t size"
.Ft void *
.Fn mlk_alloc_new0 "size_t size"
.Ft void *
.Fn mlk_alloc_renew "void *ptr, size_t size"
.Ft void *
.Fn mlk_alloc_renew0 "void *ptr, size_t oldsize, size_t newsize"
.Sh DESCRIPTION
.Pp
The
.Fn mlk_alloc_new
and
.Fn mlk_alloc_new0
functions allocate memory data of the given
.Fa size .
The
.Fn mlk_alloc_new0
variant ensure the data is being zero-initialized.
.Pp
The
.Fn mlk_alloc_renew
function reallocates the pointer
.Fa ptr
according to its
.Fa size .
.Pp
The
.Fn mlk_alloc_renew0
function is similar to
.Fn mlk_alloc_renew
but zero-initialize the memory. It needs the previous size given in
.Fa oldsize
argument because the function would not know which memory region to zero
initialize when increasing the memory.
.Sh RETURN VALUES
All functions return a pointer to the memory according to the current
allocation strategy.
.Sh SEE ALSO
.Xr mlk-alloc 3 ,
.Xr mlk_alloc_set 3
.Sh AUTHORS
.An David Demelier Aq Mt markand@malikania.fr .