Navit SVN

/work/compile/navit/src/navit/support/glib/galloca.h

00001 /* GLIB - Library of useful routines for C programming
00002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 /*
00021  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00022  * file for a list of people on the GLib Team.  See the ChangeLog
00023  * files for a list of changes.  These files are distributed with
00024  * GLib at ftp://ftp.gtk.org/pub/gtk/.
00025  */
00026 
00027 #if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
00028 #error "Only <glib.h> can be included directly."
00029 #endif
00030 
00031 #ifndef __G_ALLOCA_H__
00032 #define __G_ALLOCA_H__
00033 
00034 #include <glib/gtypes.h>
00035 
00036 #ifdef  __GNUC__
00037 /* GCC does the right thing */
00038 # undef alloca
00039 # define alloca(size)   __builtin_alloca (size)
00040 #elif defined (GLIB_HAVE_ALLOCA_H)
00041 /* a native and working alloca.h is there */ 
00042 # include <alloca.h>
00043 #else /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */
00044 # if defined(_MSC_VER) || defined(__DMC__)
00045 #  include <malloc.h>
00046 #  define alloca _alloca
00047 # else /* !_MSC_VER && !__DMC__ */
00048 #  ifdef _AIX
00049 #   pragma alloca
00050 #  else /* !_AIX */
00051 #   ifndef alloca /* predefined by HP cc +Olibcalls */
00052 G_BEGIN_DECLS
00053 char *alloca ();
00054 G_END_DECLS
00055 #   endif /* !alloca */
00056 #  endif /* !_AIX */
00057 # endif /* !_MSC_VER && !__DMC__ */
00058 #endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */
00059 
00060 #define g_alloca(size)           alloca (size)
00061 #define g_newa(struct_type, n_structs)  ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs)))
00062 
00063 #endif /* __G_ALLOCA_H__ */