]> granicus.if.org Git - php/commitdiff
Macro: php_stream_get_from_zval(php_stream *stream, zval **zstream, char *mode, int...
authorSara Golemon <pollita@php.net>
Thu, 17 Apr 2003 00:00:34 +0000 (00:00 +0000)
committerSara Golemon <pollita@php.net>
Thu, 17 Apr 2003 00:00:34 +0000 (00:00 +0000)
main/php_streams.h

index 21d53976a846c90207b39c2562edcacc809165ad..9d06932aab1984b2fbfe7b3105a18d4e73af4b7a 100755 (executable)
@@ -456,6 +456,12 @@ PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len
 #define php_stream_open_wrapper(path, mode, options, opened)   _php_stream_open_wrapper_ex((path), (mode), (options), (opened), NULL STREAMS_CC TSRMLS_CC)
 #define php_stream_open_wrapper_ex(path, mode, options, opened, context)       _php_stream_open_wrapper_ex((path), (mode), (options), (opened), (context) STREAMS_CC TSRMLS_CC)
 
+#define php_stream_get_from_zval(stream, zstream, mode, options, opened, context) \
+               if (Z_TYPE_PP((zstream)) == IS_RESOURCE) { \
+                       php_stream_from_zval((stream), (zstream)); \
+               } else (stream) = Z_TYPE_PP((zstream)) == IS_STRING ?  \
+                       php_stream_open_wrapper_ex(Z_STRVAL_PP((zstream)), (mode), (options), (opened), (context)) : NULL
+
 /* pushes an error message onto the stack for a wrapper instance */
 PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int options TSRMLS_DC, const char *fmt, ...);