]> git.saurik.com Git - apple/libc.git/blame - stdlib/FreeBSD/alloca.3.patch
Libc-763.13.tar.gz
[apple/libc.git] / stdlib / FreeBSD / alloca.3.patch
CommitLineData
1f2f436a
A
1--- alloca.3.orig 2010-02-22 12:44:05.000000000 -0800
2+++ alloca.3 2010-02-22 12:50:53.000000000 -0800
3@@ -34,25 +34,25 @@
4 .Sh NAME
5 .Nm alloca
6 .Nd memory allocator
7-.Sh LIBRARY
8-.Lb libc
9385eb3d
A
9 .Sh SYNOPSIS
10+.In alloca.h
11+or
12+.br
13 .In stdlib.h
14 .Ft void *
15 .Fn alloca "size_t size"
1f2f436a
A
16 .Sh DESCRIPTION
17 The
18 .Fn alloca
19-function
20+macro
21 allocates
22 .Fa size
23 bytes of space in the stack frame of the caller.
24 This temporary space is automatically freed on
25 return.
26 .Sh RETURN VALUES
27-The
28 .Fn alloca
29-function returns a pointer to the beginning of the allocated space.
30+returns a pointer to the beginning of the allocated space.
31 .Sh SEE ALSO
32 .Xr brk 2 ,
33 .Xr calloc 3 ,
34@@ -60,24 +60,20 @@ function returns a pointer to the beginn
35 .Xr malloc 3 ,
36 .Xr realloc 3
37 .Sh HISTORY
38-The
39 .Fn alloca
40-function appeared in
41+appeared in
42 .At 32v .
43 .\" .Bx ?? .
44 .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
45 .\" The first man page (or link to a man page that I can find at the
46 .\" moment is 4.3...
47 .Sh BUGS
48-The
49 .Fn alloca
50-function
51 is machine and compiler dependent;
52 its use is discouraged.
53 .Pp
54-The
55 .Fn alloca
56-function is slightly unsafe because it cannot ensure that the pointer
57+is slightly unsafe because it cannot ensure that the pointer
58 returned points to a valid and usable block of memory.
59 The allocation made may exceed the bounds of the stack, or even go
60 further into other objects in memory, and
61@@ -86,3 +82,8 @@ cannot determine such an error.
62 Avoid
63 .Fn alloca
64 with large unbounded allocations.
65+.Pp
66+The use of C99 variable-length arrays and
67+.Fn alloca
68+in the same function will cause the lifetime of alloca's storage to be limited to the block containing the
69+.Fn alloca