Mercurial > molko
comparison man/mlk_alloc_new.3 @ 442:9c3b3935f0aa
core: rework allocations
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 03 Nov 2022 21:09:25 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
441:31c1bbc33813 | 442:9c3b3935f0aa |
---|---|
1 .Dd $Mdocdate$ | |
2 .Dt MLK_ALLOC_NEW 3 | |
3 .Os | |
4 .Sh NAME | |
5 .Nm mlk_alloc_new , | |
6 .Nm mlk_alloc_new0 , | |
7 .Nm mlk_alloc_renew , | |
8 .Nm mlk_alloc_renew0 | |
9 .Nd allocate memory | |
10 .Sh LIBRARY | |
11 libmlk-core (-lmlk-core) | |
12 .Sh SYNOPSIS | |
13 .In mlk/core/alloc.h | |
14 .Ft void * | |
15 .Fn mlk_alloc_new "size_t size" | |
16 .Ft void * | |
17 .Fn mlk_alloc_new0 "size_t size" | |
18 .Ft void * | |
19 .Fn mlk_alloc_renew "void *ptr, size_t size" | |
20 .Ft void * | |
21 .Fn mlk_alloc_renew0 "void *ptr, size_t oldsize, size_t newsize" | |
22 .Sh DESCRIPTION | |
23 .Pp | |
24 The | |
25 .Fn mlk_alloc_new | |
26 and | |
27 .Fn mlk_alloc_new0 | |
28 functions allocate memory data of the given | |
29 .Fa size . | |
30 The | |
31 .Fn mlk_alloc_new0 | |
32 variant ensure the data is being zero-initialized. | |
33 .Pp | |
34 The | |
35 .Fn mlk_alloc_renew | |
36 function reallocates the pointer | |
37 .Fa ptr | |
38 according to its | |
39 .Fa size . | |
40 .Pp | |
41 The | |
42 .Fn mlk_alloc_renew0 | |
43 function is similar to | |
44 .Fn mlk_alloc_renew | |
45 but zero-initialize the memory. It needs the previous size given in | |
46 .Fa oldsize | |
47 argument because the function would not know which memory region to zero | |
48 initialize when increasing the memory. | |
49 .Sh RETURN VALUES | |
50 All functions return a pointer to the memory according to the current | |
51 allocation strategy. | |
52 .Sh SEE ALSO | |
53 .Xr mlk-alloc 3 , | |
54 .Xr mlk_alloc_set 3 | |
55 .Sh AUTHORS | |
56 .An David Demelier Aq Mt markand@malikania.fr . |