]> granicus.if.org Git - php/commitdiff
- Centralize some configuration stuff
authorAndi Gutmans <andi@php.net>
Wed, 6 Sep 2000 20:27:12 +0000 (20:27 +0000)
committerAndi Gutmans <andi@php.net>
Wed, 6 Sep 2000 20:27:12 +0000 (20:27 +0000)
- Use inline in my strtok_r implementation

TSRM/tsrm_config.w32.h
TSRM/tsrm_config_common.h [new file with mode: 0644]
TSRM/tsrm_strtok_r.c
TSRM/tsrm_virtual_cwd.c
TSRM/tsrm_virtual_cwd.h

index 709d9003f905ad52bfb77c4fbc69faa825006538..405d8c7c8f301150399fcf9f0e6e9be08354470c 100644 (file)
@@ -2,5 +2,14 @@
 #define TSRM_CONFIG_W32_H
 
 #define HAVE_UTIME 1
+#define HAVE_ALLOCA 1
+
+#undef inline
+#ifdef ZEND_WIN32_FORCE_INLINE
+# define inline __forceinline
+#else
+# define inline
+#endif
+
 
 #endif
diff --git a/TSRM/tsrm_config_common.h b/TSRM/tsrm_config_common.h
new file mode 100644 (file)
index 0000000..1bec4d8
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef TSRM_CONFIG_COMMON_H
+#define TSRM_CONFIG_COMMON_H
+
+#if WINNT|WIN32
+# define TSRM_WIN32
+#endif
+
+#ifndef TSRM_WIN32
+# include "tsrm_config.h"
+#else
+# include "tsrm_config.w32.h"
+#endif
+
+#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2))
+# define tsrm_do_alloca(p) alloca(p)
+# define tsrm_free_alloca(p)
+#else
+# define tsrm_do_alloca(p)   malloc(p)
+# define tsrm_free_alloca(p) free(p)
+#endif
+
+#endif /* TSRM_CONFIG_COMMON_H */
index b631825140ed10952318eb5dad286309205b4e49..e9ad26a7ac2975c7de06fa76f0169bedad846097 100644 (file)
@@ -1,8 +1,9 @@
-#include "tsrm_strtok_r.h"
-
 #include <stdio.h>
 
-static int in_character_class(char ch, const char *delim)
+#include "tsrm_config_common.h"
+#include "tsrm_strtok_r.h"
+
+static inline int in_character_class(char ch, const char *delim)
 {
        while (*delim) {
                if (*delim == ch) {
index e1d7d492c31ccd6b8c16eb43e1fd0991a9a0c44b..e19a8b2513db7bbd9acdce563e8a63ad5d6dc950 100644 (file)
 #define MAXPATHLEN 256
 #endif
 
-#ifndef do_alloca
-# if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(TSRM_WIN32))
-#  define do_alloca(p) alloca(p)
-#  define free_alloca(p)
-# else
-#  define do_alloca(p)   malloc(p)
-#  define free_alloca(p) free(p)
-# endif
-#endif
-
 #ifdef TSRM_WIN32
 #include <io.h>
 #endif
@@ -444,14 +434,14 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
        if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
                length++;
        }
-       temp = (char *) do_alloca(length+1);
+       temp = (char *) tsrm_do_alloca(length+1);
        memcpy(temp, path, length);
        temp[length] = 0;
 #if VIRTUAL_CWD_DEBUG
        fprintf (stderr, "Changing directory to %s\n", temp);
 #endif
        retval = p_chdir(temp);
-       free_alloca(temp);
+       tsrm_free_alloca(temp);
        return retval;
 }
 
index 0a882c364cfec70cc5283cf1b3b111c4e10da354..eee3ad0480c73a68f1ae7f7fef6b40aff37fd1fb 100644 (file)
 #ifndef VIRTUAL_CWD_H
 #define VIRTUAL_CWD_H
 
-#ifdef WIN32
-# define TSRM_WIN32
-#endif
-
-#ifndef TSRM_WIN32
-# include "tsrm_config.h"
-#else
-# include "tsrm_config.w32.h"
-#endif
+#include "tsrm_config_common.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>