com php-src: more feasible solution for zpp specs using compat.h: compat/PECL_PORTING compat/compat.h compat/replace.ph p
| From: | Anatol Belski | Date: | Thu, 30 Jan 2014 17:26:21 +0000 |
| Subject: | com php-src: more feasible solution for zpp specs using compat.h: compat/PECL_PORTING compat/compat.h compat/replace.ph p | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75867@lists.php.net to get a copy of this message | ||
Commit: 31ca11d1b6edadffc3aa6f72c480b881aabfbb6c
Author: Anatol Belski <ab@php.net> Thu, 30 Jan 2014 18:26:21 +0100
Parents: d329b89a55a3fb000b012a6222856077183d0675
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=31ca11d1b6edadffc3aa6f72c480b881aabfbb6c
Log:
more feasible solution for zpp specs using compat.h
Changed paths:
M compat/PECL_PORTING
M compat/compat.h
M compat/replace.php
Diff:
diff --git a/compat/PECL_PORTING b/compat/PECL_PORTING
index e3d55ad..7bfe746 100644
--- a/compat/PECL_PORTING
+++ b/compat/PECL_PORTING
@@ -132,6 +132,10 @@ II.. Porting steps
inclusion might depend on the concrete extension code, while in general it
might make sense to include it after all the other headers.
+ The header itself might of course need some customization for concrete code. The
+ basic version provides macros PHP_NEED_STRSIZE_COMPAT, which will evaluate to
+ true when compiling with versions lover than <str_size_and_int64>.
+
iii. zend_parse_parameters()
The arg specs 'l', 'L', 's' and 'p' are not available
anymore. As their
@@ -152,6 +156,11 @@ II. Porting steps
return;
}
+ Another way implemented when using the standard compat.h and replace..php --zpp-compat
+ will automatically replace the old specs with the macros like
+
+ ZPP_FMT_COMPAT("lSsp", "iISP")
+
iv. Manual code fixes
diff --git a/compat/compat.h b/compat/compat.h
index 9fb9a9d..7808855 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -22,9 +22,9 @@
#define PHP_SIZE_INT_COMPAT_H
/* XXX change the check accordingly to the vote results */
-#define PHP_NEED_STRSIZE_COMPAT (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 &&
PHP_MINOR_VERSION < 6)
+#define PHP_NEED_STRSIZE_COMPAT (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 &&
PHP_MINOR_VERSION < 6) || defined(PHP_FORCE_STRSIZE_COMPAT)
-#if PHP_NEED_STRSIZE_COMPAT || PHP_FORCE_STRSIZE_COMPAT
+#if PHP_NEED_STRSIZE_COMPAT
typedef long zend_int_t;
typedef unsigned long zend_uint_t;
@@ -132,6 +132,12 @@ typedef struct stat zend_stat_t;
# define cfg_get_int cfg_get_long
# define pdo_attr_ival pdo_attr_lval
+# define ZPP_FMT_COMPAT(old_fmt, new_fmt) old_fmt
+
+#else
+
+# define ZPP_FMT_COMPAT(old_fmt, new_fmt) new_fmt
+
#endif
#endif /* PHP_SIZE_INT_COMPAT_H */
diff --git a/compat/replace.php b/compat/replace.php
index e7938aa..86d8678 100644
--- a/compat/replace.php
+++ b/compat/replace.php
@@ -154,7 +154,7 @@ if ($replace_zpp || $replace_zpp_compat) {
echo "WARNING: reverse replace with --zpp-compat is ommited";
} else {
foreach ($specs as $spec0 => $spec1) {
- $specs[$spec0] = "(PHP_NEED_STRSIZE_COMPAT ? $spec0 : $spec1)";
+ $specs[$spec0] = "ZPP_FMT_COMPAT($spec0, $spec1)";
}
$file_contents = str_replace(array_keys($specs), array_values($specs), $file_contents);
}