bjori           Sat Aug 16 10:57:26 2008 UTC

  Modified files:              
    /php-src/ext/standard       basic_functions.c streamsfuncs.c 
                                streamsfuncs.h 
  Log:
  Added stream_context_set_default() function. (Davey Shafik)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.917&r2=1.918&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.917 
php-src/ext/standard/basic_functions.c:1.918
--- php-src/ext/standard/basic_functions.c:1.917        Thu Aug 14 10:11:26 2008
+++ php-src/ext/standard/basic_functions.c      Sat Aug 16 10:57:26 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.917 2008/08/14 10:11:26 tony2001 Exp $ */
+/* $Id: basic_functions.c,v 1.918 2008/08/16 10:57:26 bjori Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2381,6 +2381,11 @@
 ZEND_END_ARG_INFO()
 
 static
+ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_default, 0)
+       ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+static
 ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_create, 0, 0, 0)
        ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
        ZEND_ARG_INFO(0, params) /* ARRAY_INFO(0, params, 1) */
@@ -3553,6 +3558,7 @@
        PHP_FE(stream_context_set_option,                                       
                                        arginfo_stream_context_set_option)
        PHP_FE(stream_context_get_options,                                      
                                        arginfo_stream_context_get_options)
        PHP_FE(stream_context_get_default,                                      
                                        arginfo_stream_context_get_default)
+       PHP_FE(stream_context_set_default,                                      
                                        arginfo_stream_context_set_default)
        PHP_FE(stream_filter_prepend,                                           
                                        arginfo_stream_filter_prepend)
        PHP_FE(stream_filter_append,                                            
                                        arginfo_stream_filter_append)
        PHP_FE(stream_filter_remove,                                            
                                        arginfo_stream_filter_remove)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.120&r2=1.121&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.120 
php-src/ext/standard/streamsfuncs.c:1.121
--- php-src/ext/standard/streamsfuncs.c:1.120   Wed Jul 23 11:24:35 2008
+++ php-src/ext/standard/streamsfuncs.c Sat Aug 16 10:57:26 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: streamsfuncs.c,v 1.120 2008/07/23 11:24:35 tony2001 Exp $ */
+/* $Id: streamsfuncs.c,v 1.121 2008/08/16 10:57:26 bjori Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -1158,6 +1158,28 @@
 }
 /* }}} */
 
+/* {{{ proto resource stream_context_set_default(array options) U
+   Set default file/stream context, returns the context as a resource */
+PHP_FUNCTION(stream_context_set_default)
+{
+       zval *options = NULL;
+       php_stream_context *context;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &options) == 
FAILURE) {
+               return;
+       }
+
+       if (FG(default_context) == NULL) {
+               FG(default_context) = php_stream_context_alloc();
+       }
+       context = FG(default_context);
+
+       parse_context_options(context, options TSRMLS_CC);
+
+       php_stream_context_to_zval(context, return_value);
+}
+/* }}} */
+
 /* {{{ proto resource stream_context_create([array options[, array params]]) U
    Create a file context and optionally set parameters */
 PHP_FUNCTION(stream_context_create)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.h?r1=1.22&r2=1.23&diff_format=u
Index: php-src/ext/standard/streamsfuncs.h
diff -u php-src/ext/standard/streamsfuncs.h:1.22 
php-src/ext/standard/streamsfuncs.h:1.23
--- php-src/ext/standard/streamsfuncs.h:1.22    Mon Dec 31 07:12:16 2007
+++ php-src/ext/standard/streamsfuncs.h Sat Aug 16 10:57:26 2008
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: streamsfuncs.h,v 1.22 2007/12/31 07:12:16 sebastian Exp $ */
+/* $Id: streamsfuncs.h,v 1.23 2008/08/16 10:57:26 bjori Exp $ */
 
 /* Flags for stream_socket_client */
 #define PHP_STREAM_CLIENT_PERSISTENT   1
@@ -49,6 +49,7 @@
 PHP_FUNCTION(stream_context_set_option);
 PHP_FUNCTION(stream_context_get_options);
 PHP_FUNCTION(stream_context_get_default);
+PHP_FUNCTION(stream_context_set_default);
 PHP_FUNCTION(stream_filter_prepend);
 PHP_FUNCTION(stream_filter_append);
 PHP_FUNCTION(stream_filter_remove);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to