view man/mlk_alloc_new.3 @ 535:7d6a879901e0

misc: fix
author David Demelier <markand@malikania.fr>
date Sun, 05 Mar 2023 10:53:05 +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 .