cvs: ZendEngine2 / zend_API.h
| From: | Andrei Zmievski | Date: | Fri, 04 Aug 2006 18:08:31 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5162@lists.php.net to get a copy of this message | ||
andrei Fri Aug 4 18:08:31 2006 UTC
Modified files:
/ZendEngine2 zend_API.h
Log:
Add macros to be able to initialize/return values based on zstr.
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.h?r1=1.251&r2=1.252&diff_format=u
Index: ZendEngine2/zend_API.h
diff -u ZendEngine2/zend_API.h:1.251 ZendEngine2/zend_API.h:1.252
--- ZendEngine2/zend_API.h:1.251 Thu Jul 20 21:16:08 2006
+++ ZendEngine2/zend_API.h Fri Aug 4 18:08:31 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_API.h,v 1.251 2006/07/20 21:16:08 helly Exp $ */
+/* $Id: zend_API.h,v 1.252 2006/08/04 18:08:31 andrei Exp $ */
#ifndef ZEND_API_H
#define ZEND_API_H
@@ -851,6 +851,28 @@
Z_TYPE_P(z) = IS_UNICODE; \
}
+#define ZVAL_ZSTR(z, zs, type, duplicate) { \
+ zstr __s=(zs); \
+ Z_UNILEN_P(z) = (type==IS_UNICODE)?u_strlen(__s):strlen(__s); \
+ Z_UNIVAL_P(z) = ZSTR(duplicate? \
+ ((type==IS_UNICODE)? \
+ (void*)eustrndup(__s.u, Z_UNILEN_P(z)) \
+ :(void*)estrndup(__s.s, Z_UNILEN_P(z))) \
+ :__s.v); \
+ Z_TYPE_P(z) = type; \
+}
+
+#define ZVAL_ZSTRL(z, zs, l, type, duplicate) { \
+ zstr __s=(zs); int __l=l; \
+ Z_UNILEN_P(z) = __l; \
+ Z_UNIVAL_P(z) = ZSTR(duplicate? \
+ ((type==IS_UNICODE)? \
+ (void*)eustrndup(__s.u, __l) \
+ :(void*)estrndup(__s.s, __l)) \
+ :__s.v); \
+ Z_TYPE_P(z) = type; \
+}
+
#define ZVAL_UCHAR32(z, ch) { \
UChar buf[3]; \
int buf_len = zend_codepoint_to_uchar(ch, buf); \
@@ -939,6 +961,8 @@
#define RETVAL_TEXT(t, duplicate) ZVAL_TEXT(return_value, t, duplicate)
#define RETVAL_TEXTL(t, l, duplicate) ZVAL_TEXTL(return_value, t, l, duplicate)
#define RETVAL_EMPTY_TEXT() ZVAL_EMPTY_TEXT(return_value)
+#define RETVAL_ZSTR(s, type, duplicate) ZVAL_ZSTR(return_value, s, type, duplicate)
+#define RETVAL_ZSTRL(s, l, type, duplicate) ZVAL_ZSTRL(return_value, s, l, type, duplicate)
#define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; }
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
@@ -964,6 +988,8 @@
#define RETURN_U_STRINGL(conv, t, l, flags) { RETVAL_U_STRINGL(conv, t, l, flags); return; }
#define RETURN_RT_STRING(t, flags) { RETVAL_RT_STRING(t, flags); return; }
#define RETURN_RT_STRINGL(t, l, flags) { RETVAL_RT_STRINGL(t, l, flags); return; }
+#define RETURN_ZSTR(s, type, duplicate) { RETVAL_ZSTR(s, type, duplicate); return; }
+#define RETURN_ZSTRL(s, l, type, duplicate) { RETVAL_ZSTRL(s, l, type, duplicate); return; }
#define SET_VAR_STRING(n, v) { \
{ \