summaryrefslogtreecommitdiff
path: root/main/streams/php_stream_context.h
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-05-21 04:04:50 +0000
committerSara Golemon <pollita@php.net>2003-05-21 04:04:50 +0000
commit83b7b75c3ca407a2e28896441a18cf9817cc212e (patch)
tree0f2c09e60a3608d6551ea80c253b9f746ed93f4f /main/streams/php_stream_context.h
parentb078f60fce48cbe01bee9db5dfcaf68b4ef304cf (diff)
downloadphp-git-83b7b75c3ca407a2e28896441a18cf9817cc212e.tar.gz
Implement default contexts. For the moment this is useless
but it will be used soon for connection pooling.
Diffstat (limited to 'main/streams/php_stream_context.h')
-rw-r--r--main/streams/php_stream_context.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index 2094b4c8a3..147de6849e 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -29,6 +29,15 @@ typedef void (*php_stream_notification_func)(php_stream_context *context,
#define PHP_STREAM_NOTIFIER_PROGRESS 1
+/* Attempt to fetch context from the zval passed,
+ If no context was passed, use the default context
+ The the default context has not yet been created, do it now. */
+#define php_stream_context_from_zval(zcontext, nocontext) ( \
+ (zcontext) ? zend_fetch_resource(&(zcontext) TSRMLS_CC, -1, "Stream-Context", NULL, 1, php_le_stream_context()) : \
+ (nocontext) ? NULL : \
+ FG(default_context) ? FG(default_context) : \
+ (FG(default_context) = php_stream_context_alloc()) )
+
typedef struct _php_stream_notifier {
php_stream_notification_func func;
void *ptr;