X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Falloca.c;h=918235df465203df525fe58b41afc9ab53b1a4cf;hb=546c73f905d4d75f07b9b083d8134e53047402d7;hp=bf105d80f0fcbc7ea883c9ff855abd26d07ec6fe;hpb=30673bf5116aafb5896d9f58010595e6c0e45e47;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/alloca.c b/libiberty/alloca.c index bf105d80f0..918235df46 100644 --- a/libiberty/alloca.c +++ b/libiberty/alloca.c @@ -21,6 +21,27 @@ allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ +/* + +@deftypefn Replacement void* alloca (size_t @var{size}) + +This function allocates memory which will be automatically reclaimed +after the procedure exits. The @libib{} implementation does not free +the memory immediately but will do so eventually during subsequent +calls to this function. Memory is allocated using @code{xmalloc} under +normal circumstances. + +The header file @file{alloca-conf.h} can be used in conjunction with the +GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make +available this function. The @code{AC_FUNC_ALLOCA} test requires that +client code use a block of preprocessor code to be safe (see the Autoconf +manual for more); this header incorporates that logic and more, including +the possibility of a GCC built-in function. + +@end deftypefn + +*/ + #ifdef HAVE_CONFIG_H #include #endif @@ -34,6 +55,12 @@ #include #endif +/* These variables are used by the ASTRDUP implementation that relies + on C_alloca. */ +const char *libiberty_optr; +char *libiberty_nptr; +unsigned long libiberty_len; + /* If your stack is a linked list of frames, you have to provide an "address metric" ADDRESS_FUNCTION macro. */ @@ -123,6 +150,8 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */ caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ +/* @undocumented C_alloca */ + PTR C_alloca (size) size_t size;