Back to index

nagios-plugins  1.4.16
alloca.in.h
Go to the documentation of this file.
00001 /* Memory allocation on the stack.
00002 
00003    Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation,
00004    Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify it
00007    under the terms of the GNU General Public License as published
00008    by the Free Software Foundation; either version 3, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public
00017    License along with this program; if not, write to the Free Software
00018    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00019    USA.  */
00020 
00021 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
00022    means there is a real alloca function.  */
00023 #ifndef _GL_ALLOCA_H
00024 #define _GL_ALLOCA_H
00025 
00026 /* alloca (N) returns a pointer to N bytes of memory
00027    allocated on the stack, which will last until the function returns.
00028    Use of alloca should be avoided:
00029      - inside arguments of function calls - undefined behaviour,
00030      - in inline functions - the allocation may actually last until the
00031        calling function returns,
00032      - for huge N (say, N >= 65536) - you never know how large (or small)
00033        the stack is, and when the stack cannot fulfill the memory allocation
00034        request, the program just crashes.
00035  */
00036 
00037 #ifndef alloca
00038 # ifdef __GNUC__
00039 #  define alloca __builtin_alloca
00040 # elif defined _AIX
00041 #  define alloca __alloca
00042 # elif defined _MSC_VER
00043 #  include <malloc.h>
00044 #  define alloca _alloca
00045 # elif defined __DECC && defined __VMS
00046 #  define alloca __ALLOCA
00047 # else
00048 #  include <stddef.h>
00049 #  ifdef  __cplusplus
00050 extern "C"
00051 #  endif
00052 void *alloca (size_t);
00053 # endif
00054 #endif
00055 
00056 #endif /* _GL_ALLOCA_H */