cvs: php4 /ext/standard file.c user_filters.c

From: Date: Sun, 05 Jan 2003 22:24:49 +0000
Subject: cvs: php4 /ext/standard file.c user_filters.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-17648@lists.php.net to get a copy of this message
pollita Sun Jan 5 17:24:49 2003 EDT Modified files: /php4/ext/standard user_filters.c file.c Log: Fixes to stream_get_wrappers() and stream_get_filters() handle hash table layouts better, plus some picune whitespace fixes Index: php4/ext/standard/user_filters.c diff -u php4/ext/standard/user_filters.c:1.4 php4/ext/standard/user_filters.c:1.5 --- php4/ext/standard/user_filters.c:1.4 Sat Jan 4 22:24:38 2003 +++ php4/ext/standard/user_filters.c Sun Jan 5 17:24:49 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: user_filters.c,v 1.4 2003/01/05 03:24:38 pollita Exp $ */ +/* $Id: user_filters.c,v 1.5 2003/01/05 22:24:49 pollita Exp $ */ #include "php.h" #include "php_globals.h" @@ -416,16 +416,22 @@ PHP_FUNCTION(stream_get_filters) { char *filter_name; - int filter_name_len = 0; + int key_flags, filter_name_len = 0; + + if (ZEND_NUM_ARGS() != 0) { + WRONG_PARAM_COUNT; + } array_init(return_value); if (BG(user_filter_map)) { for(zend_hash_internal_pointer_reset(BG(user_filter_map)); - zend_hash_get_current_key_ex(BG(user_filter_map), &filter_name, &filter_name_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; + (key_flags = zend_hash_get_current_key_ex(BG(user_filter_map), &filter_name, &filter_name_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(BG(user_filter_map))) - add_next_index_string(return_value, filter_name, 1); + if (key_flags == HASH_KEY_IS_STRING) + add_next_index_stringl(return_value, filter_name, filter_name_len, 1); } + /* It's okay to return an empty array if no filters are registered */ } /* }}} */ Index: php4/ext/standard/file.c diff -u php4/ext/standard/file.c:1.287 php4/ext/standard/file.c:1.288 --- php4/ext/standard/file.c:1.287 Fri Jan 3 13:33:28 2003 +++ php4/ext/standard/file.c Sun Jan 5 17:24:49 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.287 2003/01/03 18:33:28 iliaa Exp $ */ +/* $Id: file.c,v 1.288 2003/01/05 22:24:49 pollita Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -633,7 +633,7 @@ { HashTable *url_stream_wrappers_hash; char *stream_protocol; - int stream_protocol_len = 0; + int key_flags, stream_protocol_len = 0; if (ZEND_NUM_ARGS() != 0) { WRONG_PARAM_COUNT; @@ -642,9 +642,10 @@ if (url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash()) { array_init(return_value); for(zend_hash_internal_pointer_reset(url_stream_wrappers_hash); - zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; + (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(url_stream_wrappers_hash)) - add_next_index_string(return_value,stream_protocol,1); + if (key_flags == HASH_KEY_IS_STRING) + add_next_index_stringl(return_value, stream_protocol, stream_protocol_len, 1); } else { RETURN_FALSE; }

« previous php.cvs (#17648) next »