galloca.h

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

Copyright © Nokia Corporation 2001-2008
Back to top