debian/rules: Use `git' potty wrapper.
[qmail] / alloc.3
CommitLineData
2117e02e
MW
1.TH alloc 3
2.SH NAME
3alloc \- allocate memory
4.SH SYNTAX
5.B #include <alloc.h>
6
7char *\fBalloc\fP(\fInew\fR);
8
9void \fBalloc_free\fP(\fIx\fR);
10
11void \fBalloc_re\fP(&\fIx\fR,\fIold\fR,\fInew\fR);
12
13char *\fIx\fR;
14.br
15unsigned int \fIold\fR;
16.br
17unsigned int \fInew\fR;
18.SH DESCRIPTION
19.B alloc
20allocates enough space from the heap for
21.I new
22bytes of data,
23adequately aligned for any data type.
24.I new
25may be 0.
26.B alloc
27returns a pointer to the space.
28If space is not available,
29.B alloc
30returns 0,
31setting
32.B errno
33appropriately.
34
35.B alloc_free
36returns space to the heap.
37
38.B alloc_re
39expands the space allocated to
40.I x
41from
42.I old
43bytes to
44.I new
45bytes.
46It allocates new space,
47copies
48.I old
49bytes from the old space to the new space,
50returns the old space to the heap,
51and changes
52.I x
53to point to the new space.
54It then returns 1.
55If space is not available,
56.B alloc_re
57returns 0,
58leaving the old space alone.
59.SH "SEE ALSO"
60sbrk(2),
61malloc(3),
62error(3)