cvs: /php4 php.h /php4/ext/standard basic_functions.c basic_functions.h php3_string.h string.c /php4/tests testarray
| From: | Andi Gutmans | Date: | Mon, 20 Sep 1999 16:56:03 +0000 |
| Subject: | cvs: /php4 php.h /php4/ext/standard basic_functions.c basic_functions.h php3_string.h string.c /php4/tests testarray | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4687@lists.php.net to get a copy of this message | ||
andi Mon Sep 20 12:56:03 1999 EDT
Modified files:
/php4 php.h
/php4/ext/standard basic_functions.c basic_functions.h
php3_string.h string.c
/php4/tests testarray
Log:
- Internal functions which are basic language functions should be in Zend
and not in PHP. I.e. strlen(), each(), error_reporting(), count(),
get_class_name().
Index: php4/php.h
diff -u php4/php.h:1.35 php4/php.h:1.36
--- php4/php.h:1.35 Wed Sep 15 05:51:20 1999
+++ php4/php.h Mon Sep 20 12:56:01 1999
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php.h,v 1.35 1999/09/15 09:51:20 thies Exp $ */
+/* $Id: php.h,v 1.36 1999/09/20 16:56:01 andi Exp $ */
#ifndef _PHP_H
#define _PHP_H
@@ -249,7 +249,6 @@
#define STR_FREE(ptr) if (ptr && ptr!=empty_string &&
ptr!=undefined_variable_string) { efree(ptr); }
#define COPY_STRING(yy) (yy).value.str.val = (char *)
estrndup((yy).value.str.val,(yy).value.str.len)
#define STR_PRINT(str) ((str)?(str):"")
-#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ?
(p)->value.obj.properties : NULL)))
#ifndef MAXPATHLEN
#define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.89 php4/ext/standard/basic_functions.c:1.90
--- php4/ext/standard/basic_functions.c:1.89 Mon Sep 20 06:09:57 1999
+++ php4/ext/standard/basic_functions.c Mon Sep 20 12:56:02 1999
@@ -100,7 +100,6 @@
PHP_FE(reset, first_arg_force_ref)
PHP_FE(current, first_arg_force_ref)
PHP_FE(key, first_arg_force_ref)
- PHP_FE(each, first_arg_force_ref)
PHP_FALIAS(pos, current, first_arg_force_ref)
PHP_FE(time, NULL)
@@ -137,11 +136,8 @@
PHP_FE(phpversion, NULL)
PHP_FE(phpcredits, NULL)
- PHP_FE(strlen, NULL)
- PHP_FE(strcmp, NULL)
PHP_FE(strspn, NULL)
PHP_FE(strcspn, NULL)
- PHP_FE(strcasecmp, NULL)
PHP_FE(strtok, NULL)
PHP_FE(strtoupper, NULL)
PHP_FE(strtolower, NULL)
@@ -217,8 +213,6 @@
PHP_FE(getmxrr, second_and_third_args_force_ref)
#endif
- PHP_FE(error_reporting, NULL)
-
PHP_FE(getmyuid, NULL)
PHP_FE(getmypid, NULL)
PHP_FE(getmyinode, NULL)
@@ -557,30 +551,6 @@
#endif
-PHP_FUNCTION(error_reporting)
-{
- pval *arg;
- int old_error_reporting;
- ELS_FETCH();
-
- old_error_reporting = EG(error_reporting);
- switch (ARG_COUNT(ht)) {
- case 0:
- break;
- case 1:
- if (getParameters(ht,1,&arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(arg);
- EG(error_reporting)=arg->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- RETVAL_LONG(old_error_reporting);
-}
PHP_FUNCTION(toggle_short_open_tag)
{
@@ -1096,58 +1066,6 @@
*return_value = **entry;
pval_copy_constructor(return_value);
-}
-
-
-PHP_FUNCTION(each)
-{
- pval *array,*entry,**entry_ptr, *tmp;
- char *string_key;
- ulong num_key;
- pval **inserted_pointer;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php_error(E_WARNING,"Variable passed to each() is not an array or object");
- return;
- }
- if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) {
- RETURN_FALSE;
- }
- array_init(return_value);
- entry = *entry_ptr;
-
- /* add value elements */
- if (entry->EA.is_ref) {
- tmp = (pval *)emalloc(sizeof(pval));
- *tmp = *entry;
- pval_copy_constructor(tmp);
- tmp->EA.is_ref=0;
- tmp->EA.locks = 0;
- tmp->refcount=0;
- entry=tmp;
- }
- zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(pval *), NULL);
- entry->refcount++;
- zend_hash_update_ptr(return_value->value.ht, "value", sizeof("value"),
entry, sizeof(pval *), NULL);
- entry->refcount++;
-
- /* add the key elements */
- switch (zend_hash_get_current_key(target_hash, &string_key, &num_key)) {
- case HASH_KEY_IS_STRING:
- add_get_index_string(return_value,0,string_key,(void **) &inserted_pointer,0);
- break;
- case HASH_KEY_IS_LONG:
- add_get_index_long(return_value,0,num_key, (void **) &inserted_pointer);
- break;
- }
- zend_hash_update(return_value->value.ht, "key", sizeof("key"),
inserted_pointer, sizeof(pval *), NULL);
- (*inserted_pointer)->refcount++;
- zend_hash_move_forward(target_hash);
}
Index: php4/ext/standard/basic_functions.h
diff -u php4/ext/standard/basic_functions.h:1.15 php4/ext/standard/basic_functions.h:1.16
--- php4/ext/standard/basic_functions.h:1.15 Mon Sep 20 06:09:57 1999
+++ php4/ext/standard/basic_functions.h Mon Sep 20 12:56:02 1999
@@ -29,7 +29,7 @@
*/
-/* $Id: basic_functions.h,v 1.15 1999/09/20 10:09:57 thies Exp $ */
+/* $Id: basic_functions.h,v 1.16 1999/09/20 16:56:02 andi Exp $ */
#ifndef _BASIC_FUNCTIONS_H
#define _BASIC_FUNCTIONS_H
@@ -64,7 +64,6 @@
PHP_FUNCTION(end);
PHP_FUNCTION(prev);
PHP_FUNCTION(next);
-PHP_FUNCTION(each);
PHP_FUNCTION(reset);
PHP_FUNCTION(current);
PHP_FUNCTION(key);
@@ -76,7 +75,6 @@
/* system functions */
PHP_FUNCTION(getenv);
PHP_FUNCTION(putenv);
-PHP_FUNCTION(error_reporting);
PHP_FUNCTION(get_current_user);
PHP_FUNCTION(set_time_limit);
Index: php4/ext/standard/php3_string.h
diff -u php4/ext/standard/php3_string.h:1.14 php4/ext/standard/php3_string.h:1.15
--- php4/ext/standard/php3_string.h:1.14 Mon Sep 20 11:50:55 1999
+++ php4/ext/standard/php3_string.h Mon Sep 20 12:56:02 1999
@@ -29,7 +29,7 @@
*/
-/* $Id: php3_string.h,v 1.14 1999/09/20 15:50:55 rasmus Exp $ */
+/* $Id: php3_string.h,v 1.15 1999/09/20 16:56:02 andi Exp $ */
/* Synced with php3 revision 1.43 1999-06-16 [ssb] */
@@ -40,11 +40,8 @@
extern char *strtok_string;
#endif
-PHP_FUNCTION(strlen);
-PHP_FUNCTION(strcmp);
PHP_FUNCTION(strspn);
PHP_FUNCTION(strcspn);
-PHP_FUNCTION(strcasecmp);
PHP_FUNCTION(str_replace);
PHP_FUNCTION(chop);
PHP_FUNCTION(trim);
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.38 php4/ext/standard/string.c:1.39
--- php4/ext/standard/string.c:1.38 Mon Sep 20 11:50:56 1999
+++ php4/ext/standard/string.c Mon Sep 20 12:56:02 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.38 1999/09/20 15:50:56 rasmus Exp $ */
+/* $Id: string.c,v 1.39 1999/09/20 16:56:02 andi Exp $ */
/* Synced with php3 revision 1.193 1999-06-16 [ssb] */
@@ -78,49 +78,6 @@
RETURN_STRINGL(new, newlen, 0);
}
-/* {{{ proto int strlen(string str)
- Get string length */
-PHP_FUNCTION(strlen)
-{
- pval **str;
-
- if (ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(str);
- RETVAL_LONG((*str)->value.str.len);
-}
-/* }}} */
-
-/* {{{ proto int strcmp(string str1, string str2)
- Binary safe string comparison */
-PHP_FUNCTION(strcmp)
-{
- pval *s1,*s2;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(s1);
- convert_to_string(s2);
- RETURN_LONG(php3_binary_strcmp(s1,s2));
-}
-/* }}} */
-
-/* {{{ proto int strcasecmp(string str1, string str2)
- Binary safe case-insensitive string comparison */
-PHP_FUNCTION(strcasecmp)
-{
- pval *s1,*s2;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(s1);
- convert_to_string(s2);
- RETURN_LONG(zend_binary_strcasecmp(s1, s2));
-}
-/* }}} */
/* {{{ proto int strspn(string str, string mask)
Find length of initial segment consisting entirely of characters found in mask */
Index: php4/tests/testarray
diff -u php4/tests/testarray:1.1 php4/tests/testarray:1.2
--- php4/tests/testarray:1.1 Thu Jul 8 17:42:29 1999
+++ php4/tests/testarray Mon Sep 20 12:56:02 1999
@@ -1,4 +1,3 @@
-
This is a small test...
<?