cvs: php4 /ext/standard aggregation.c basic_functions.c
| From: | Andrei Zmievski | Date: | Thu, 21 Mar 2002 15:28:47 +0000 |
| Subject: | cvs: php4 /ext/standard aggregation.c basic_functions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10526@lists.php.net to get a copy of this message | ||
andrei Thu Mar 21 10:28:47 2002 EDT
Modified files:
/php4/ext/standard aggregation.c basic_functions.c
Log:
Fix compilation when PCRE is disabled.
Index: php4/ext/standard/aggregation.c
diff -u php4/ext/standard/aggregation.c:1.6 php4/ext/standard/aggregation.c:1.7
--- php4/ext/standard/aggregation.c:1.6 Tue Mar 12 21:49:03 2002
+++ php4/ext/standard/aggregation.c Thu Mar 21 10:28:46 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: aggregation.c,v 1.6 2002/03/13 02:49:03 wez Exp $ */
+/* $Id: aggregation.c,v 1.7 2002/03/21 15:28:46 andrei Exp $ */
#include "php.h"
#include "basic_functions.h"
@@ -86,20 +86,25 @@
uint func_name_len;
ulong num_key;
zval *list_hash = NULL;
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
pcre *re = NULL;
pcre_extra *re_extra = NULL;
int re_options = 0;
+#endif
/*
* Flip the array for easy lookup, or compile the regexp.
*/
if (aggr_type == AGGREGATE_BY_LIST) {
list_hash = array_to_hash(aggr_filter);
- } else if (aggr_type == AGGREGATE_BY_REGEXP) {
+ }
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+ else if (aggr_type == AGGREGATE_BY_REGEXP) {
if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options)) ==
NULL) {
return;
}
}
+#endif
/*
* "Just because it's not nice doesn't mean it's not miraculous."
@@ -122,9 +127,13 @@
/* 2. private methods (heh, like we really have them) */
func_name[0] == '_' ||
/* 3. explicitly excluded methods */
- (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), func_name,
func_name_len)) ||
+ (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), func_name,
func_name_len))
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+ ||
/* 4. methods matching regexp as modified by the exclusion flag */
- (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, func_name,
func_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1) {
+ (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, func_name,
func_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1
+#endif
+ ) {
zend_hash_move_forward_ex(&from_ce->function_table, &pos);
continue;
}
@@ -178,9 +187,11 @@
uint prop_name_len;
ulong num_key;
zval *list_hash = NULL;
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
pcre *re = NULL;
pcre_extra *re_extra = NULL;
int re_options = 0;
+#endif
if (!from_ce->constants_updated) {
zend_hash_apply_with_argument(&from_ce->default_properties, (apply_func_arg_t)
zval_update_constant, (void *) 1 TSRMLS_CC);
@@ -192,11 +203,14 @@
*/
if (aggr_type == AGGREGATE_BY_LIST) {
list_hash = array_to_hash(aggr_filter);
- } else if (aggr_type == AGGREGATE_BY_REGEXP) {
+ }
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+ else if (aggr_type == AGGREGATE_BY_REGEXP) {
if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options)) ==
NULL) {
return;
}
}
+#endif
/*
* "Just because it's not nice doesn't mean it's not miraculous."
@@ -217,9 +231,13 @@
* 1. private properties (heh, like we really have them) */
if (prop_name[0] == '_' ||
/* 2. explicitly excluded properties */
- (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), prop_name,
prop_name_len)) ||
+ (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), prop_name,
prop_name_len))
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+ ||
/* 3. properties matching regexp as modified by the exclusion flag */
- (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, prop_name,
prop_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1) {
+ (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, prop_name,
prop_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1
+#endif
+ ) {
zend_hash_move_forward_ex(&from_ce->default_properties, &pos);
continue;
}
@@ -478,15 +496,6 @@
/* }}} */
-/* {{{ proto void aggregate_methods_by_regexp(object obj, string class, string regexp [, bool
exclude])
- */
-PHP_FUNCTION(aggregate_methods_by_regexp)
-{
- aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_BY_REGEXP);
-}
-/* }}} */
-
-
/* {{{ proto void aggregate_properties(object obj, string class)
*/
PHP_FUNCTION(aggregate_properties)
@@ -504,6 +513,15 @@
}
/* }}} */
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+/* {{{ proto void aggregate_methods_by_regexp(object obj, string class, string regexp [, bool
exclude])
+ */
+PHP_FUNCTION(aggregate_methods_by_regexp)
+{
+ aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_BY_REGEXP);
+}
+/* }}} */
+
/* {{{ proto void aggregate_properties_by_regexp(object obj, string class, string regexp [, bool
exclude])
*/
@@ -512,6 +530,7 @@
aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_PROPERTIES, AGGREGATE_BY_REGEXP);
}
/* }}} */
+#endif
/* {{{ proto array aggregation_info(object obj)
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.461 php4/ext/standard/basic_functions.c:1.462
--- php4/ext/standard/basic_functions.c:1.461 Tue Mar 19 09:35:54 2002
+++ php4/ext/standard/basic_functions.c Thu Mar 21 10:28:46 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.461 2002/03/19 14:35:54 wez Exp $ */
+/* $Id: basic_functions.c,v 1.462 2002/03/21 15:28:46 andrei Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -819,10 +819,12 @@
PHP_FE(aggregate, first_arg_force_ref)
PHP_FE(aggregate_methods, first_arg_force_ref)
PHP_FE(aggregate_methods_by_list, first_arg_force_ref)
- PHP_FE(aggregate_methods_by_regexp, first_arg_force_ref)
PHP_FE(aggregate_properties, first_arg_force_ref)
PHP_FE(aggregate_properties_by_list, first_arg_force_ref)
+#if HAVE_PCRE || HAVE_BUNDLED_PCRE
+ PHP_FE(aggregate_methods_by_regexp, first_arg_force_ref)
PHP_FE(aggregate_properties_by_regexp, first_arg_force_ref)
+#endif
PHP_FE(deaggregate, first_arg_force_ref)
PHP_FE(aggregation_info, first_arg_force_ref)
{NULL, NULL, NULL}