X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/fbd86d4cc20b02a10edcca92fb7ae0a143e63cc4..1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58:/stdlib/FreeBSD/alloca.3.patch diff --git a/stdlib/FreeBSD/alloca.3.patch b/stdlib/FreeBSD/alloca.3.patch index f3ccd8a..bf397fb 100644 --- a/stdlib/FreeBSD/alloca.3.patch +++ b/stdlib/FreeBSD/alloca.3.patch @@ -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 @@ -10,3 +13,57 @@ .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