]> git.saurik.com Git - apple/libc.git/blobdiff - stdlib/FreeBSD/alloca.3.patch
Libc-763.11.tar.gz
[apple/libc.git] / stdlib / FreeBSD / alloca.3.patch
index f3ccd8a2dc27f56d7645e084c06a687a21322d96..bf397fb0660109407fd6f73c31bf436647896984 100644 (file)
@@ -1,8 +1,11 @@
---- /Volumes/XDisk/tmp/Libc/stdlib/FreeBSD/alloca.3.orig       2003-06-28 15:12:30.000000000 -0700
-+++ /Volumes/XDisk/tmp/Libc/stdlib/FreeBSD/alloca.3    2004-10-24 17:08:31.000000000 -0700
-@@ -41,6 +41,9 @@
- .Sh LIBRARY
- .Lb libc
+--- alloca.3.orig      2010-02-22 12:44:05.000000000 -0800
++++ alloca.3   2010-02-22 12:50:53.000000000 -0800
+@@ -34,25 +34,25 @@
+ .Sh NAME
+ .Nm alloca
+ .Nd memory allocator
+-.Sh LIBRARY
+-.Lb libc
  .Sh SYNOPSIS
 +.In alloca.h
 +or
  .In stdlib.h
  .Ft void *
  .Fn alloca "size_t size"
+ .Sh DESCRIPTION
+ The
+ .Fn alloca
+-function
++macro
+ allocates
+ .Fa size
+ bytes of space in the stack frame of the caller.
+ This temporary space is automatically freed on
+ return.
+ .Sh RETURN VALUES
+-The
+ .Fn alloca
+-function returns a pointer to the beginning of the allocated space.
++returns a pointer to the beginning of the allocated space.
+ .Sh SEE ALSO
+ .Xr brk 2 ,
+ .Xr calloc 3 ,
+@@ -60,24 +60,20 @@ function returns a pointer to the beginn
+ .Xr malloc 3 ,
+ .Xr realloc 3
+ .Sh HISTORY
+-The
+ .Fn alloca
+-function appeared in
++appeared in
+ .At 32v .
+ .\" .Bx ?? .
+ .\" The function appeared in 32v, pwb and pwb.2 and in 3bsd 4bsd
+ .\" The first man page (or link to a man page that I can find at the
+ .\" moment is 4.3...
+ .Sh BUGS
+-The
+ .Fn alloca
+-function
+ is machine and compiler dependent;
+ its use is discouraged.
+ .Pp
+-The
+ .Fn alloca
+-function is slightly unsafe because it cannot ensure that the pointer
++is slightly unsafe because it cannot ensure that the pointer
+ returned points to a valid and usable block of memory.
+ The allocation made may exceed the bounds of the stack, or even go
+ further into other objects in memory, and
+@@ -86,3 +82,8 @@ cannot determine such an error.
+ Avoid
+ .Fn alloca
+ with large unbounded allocations.
++.Pp
++The use of C99 variable-length arrays and
++.Fn alloca
++in the same function will cause the lifetime of alloca's storage to be limited to the block containing the
++.Fn alloca