Back to index

php5  5.3.10
tsrm_config_common.h
Go to the documentation of this file.
00001 #ifndef TSRM_CONFIG_COMMON_H
00002 #define TSRM_CONFIG_COMMON_H
00003 
00004 #ifndef __CYGWIN__
00005 # if WINNT|WIN32
00006 #  define TSRM_WIN32
00007 # endif
00008 #endif
00009 
00010 #ifdef TSRM_WIN32
00011 # include "tsrm_config.w32.h"
00012 #else
00013 # include <tsrm_config.h>
00014 # include <sys/param.h>
00015 #endif
00016 
00017 #if HAVE_ALLOCA_H && !defined(_ALLOCA_H)
00018 #  include <alloca.h>
00019 #endif
00020 
00021 /* AIX requires this to be the first thing in the file.  */
00022 #ifndef __GNUC__
00023 # ifndef HAVE_ALLOCA_H
00024 #  ifdef _AIX
00025 #pragma alloca
00026 #  else
00027 #   ifndef alloca /* predefined by HP cc +Olibcalls */
00028 #    ifndef NETWARE
00029 char *alloca ();
00030 #    endif
00031 #   endif
00032 #  endif
00033 # endif
00034 #endif
00035 
00036 #if HAVE_UNISTD_H
00037 #include <unistd.h>
00038 #endif
00039 
00040 #if HAVE_LIMITS_H
00041 #include <limits.h>
00042 #endif
00043 
00044 #ifndef MAXPATHLEN
00045 # ifdef PATH_MAX
00046 #  define MAXPATHLEN PATH_MAX
00047 # elif defined(MAX_PATH)
00048 #  define MAXPATHLEN MAX_PATH
00049 # else
00050 #  define MAXPATHLEN 256
00051 # endif
00052 #endif
00053 
00054 #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
00055 # define TSRM_ALLOCA_MAX_SIZE 4096
00056 # define TSRM_ALLOCA_FLAG(name) \
00057        int name;
00058 # define tsrm_do_alloca_ex(size, limit, use_heap) \
00059        ((use_heap = ((size) > (limit))) ? malloc(size) : alloca(size))
00060 # define tsrm_do_alloca(size, use_heap) \
00061        tsrm_do_alloca_ex(size, TSRM_ALLOCA_MAX_SIZE, use_heap)
00062 # define tsrm_free_alloca(p, use_heap) \
00063        do { if (use_heap) free(p); } while (0)
00064 #else
00065 # define TSRM_ALLOCA_FLAG(name)
00066 # define tsrm_do_alloca(p, use_heap)      malloc(p)
00067 # define tsrm_free_alloca(p, use_heap)    free(p)
00068 #endif
00069 
00070 #endif /* TSRM_CONFIG_COMMON_H */