Just curious about the NEWS entry. What kind of use is it
for end user to know that the API contains some new functions..?
--Jani
On Fri, 4 Feb 2005, Hartmut Holzgraefe wrote:
hholzgra Fri Feb 4 15:24:21 2005 EDT
Modified files:
/php-src NEWS
/ZendEngine2 zend_API.c zend_API.h
Log:
added some missing zend_[declare|update]_property_...() convenience
functions for bool, double and binary safe string data
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1837&r2=1.1838&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1837 php-src/NEWS:1.1838
--- php-src/NEWS:1.1837 Wed Feb 2 09:44:36 2005
+++ php-src/NEWS Fri Feb 4 15:24:21 2005
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2004, PHP 5.1.0
+- Added zend_declare_property_...() and zend_update_property_...()
+ API functions for bool, double and binary safe strings. (Hartmut)
- Moved extensions to PECL:
. ext/dio (Jani, Derick)
. ext/yp (Jani, Derick)
http://cvs.php.net/diff.php/ZendEngine2/zend_API.c?r1=1.272&r2=1.273&ty=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.272 ZendEngine2/zend_API.c:1.273
--- ZendEngine2/zend_API.c:1.272 Sat Jan 22 07:23:01 2005
+++ ZendEngine2/zend_API.c Fri Feb 4 15:24:21 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.c,v 1.272 2005/01/22 12:23:01 helly Exp $ */
+/* $Id: zend_API.c,v 1.273 2005/02/04 20:24:21 hholzgra Exp $ */
#include "zend.h"
#include "zend_execute.h"
@@ -1970,6 +1970,20 @@
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
+ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC)
+{
+ zval *property;
+
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ property = malloc(sizeof(zval));
+ } else {
+ ALLOC_ZVAL(property);
+ }
+ INIT_PZVAL(property);
+ ZVAL_BOOL(property, value);
+ return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+}
+
ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC)
{
zval *property;
@@ -1984,6 +1998,20 @@
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
+ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC)
+{
+ zval *property;
+
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ property = malloc(sizeof(zval));
+ } else {
+ ALLOC_ZVAL(property);
+ }
+ INIT_PZVAL(property);
+ ZVAL_DOUBLE(property, value);
+ return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+}
+
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC)
{
zval *property;
@@ -2000,6 +2028,21 @@
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
+ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC)
+{
+ zval *property;
+
+ if (ce->type & ZEND_INTERNAL_CLASS) {
+ property = malloc(sizeof(zval));
+ ZVAL_STRINGL(property, zend_strndup(value, value_len), value_len, 0);
+ } else {
+ ALLOC_ZVAL(property);
+ ZVAL_STRINGL(property, value, value_len, 1);
+ }
+ INIT_PZVAL(property);
+ return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
+}
+
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC)
{
zval property;
@@ -2027,6 +2070,17 @@
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
+ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_BOOL(tmp, value);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC)
{
zval *tmp;
@@ -2038,6 +2092,17 @@
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
+ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_LONG(tmp, value);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC)
{
zval *tmp;
@@ -2049,6 +2114,17 @@
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
+ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_STRINGL(tmp, value, value_len, 1);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)
{
zval property, *value;
http://cvs.php.net/diff.php/ZendEngine2/zend_API.h?r1=1.193&r2=1.194&ty=u
Index: ZendEngine2/zend_API.h
diff -u ZendEngine2/zend_API.h:1.193 ZendEngine2/zend_API.h:1.194
--- ZendEngine2/zend_API.h:1.193 Sat Jan 22 07:23:01 2005
+++ ZendEngine2/zend_API.h Fri Feb 4 15:24:21 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.h,v 1.193 2005/01/22 12:23:01 helly Exp $ */
+/* $Id: zend_API.h,v 1.194 2005/02/04 20:24:21 hholzgra Exp $ */
#ifndef ZEND_API_H
#define ZEND_API_H
@@ -188,14 +188,20 @@
ZEND_API int zend_get_module_started(char *module_name);
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_long(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
+ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
+ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
+ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
+ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);