cvs: php4 /main fopen-wrappers.c
| From: | Sascha Schumann | Date: | Sun, 22 Oct 2000 14:42:56 +0000 |
| Subject: | cvs: php4 /main fopen-wrappers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2218@lists.php.net to get a copy of this message | ||
sas Sun Oct 22 07:42:56 2000 EDT
Modified files:
/php4/main fopen-wrappers.c
Log:
We don't need to store NUL of the key which simplifies the lookup
significantly.
Index: php4/main/fopen-wrappers.c
diff -u php4/main/fopen-wrappers.c:1.99 php4/main/fopen-wrappers.c:1.100
--- php4/main/fopen-wrappers.c:1.99 Thu Oct 19 08:05:44 2000
+++ php4/main/fopen-wrappers.c Sun Oct 22 07:42:55 2000
@@ -16,7 +16,7 @@
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen-wrappers.c,v 1.99 2000/10/19 15:05:44 joey Exp $ */
+/* $Id: fopen-wrappers.c,v 1.100 2000/10/22 14:42:55 sas Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -91,7 +91,7 @@
PLS_FETCH();
if(PG(allow_url_fopen)) {
- return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol)+1, &wrapper,
sizeof(wrapper), NULL);
+ return zend_hash_add(&fopen_url_wrappers_hash, protocol, strlen(protocol), &wrapper,
sizeof(wrapper), NULL);
} else {
return FAILURE;
}
@@ -102,7 +102,7 @@
PLS_FETCH();
if(PG(allow_url_fopen)) {
- return zend_hash_del(&fopen_url_wrappers_hash, protocol, strlen(protocol)+1);
+ return zend_hash_del(&fopen_url_wrappers_hash, protocol, strlen(protocol));
} else {
return SUCCESS;
}
@@ -439,16 +439,10 @@
if(protocol) {
php_fopen_url_wrapper_t *wrapper=NULL;
- char *protocopy = emalloc(n+1);
- if(protocopy) {
- strncpy(protocopy,protocol,n);
- protocopy[n]='\0';
- if(FAILURE==zend_hash_find(&fopen_url_wrappers_hash, protocopy, n+1,(void **)&wrapper))
{
- wrapper=NULL;
- protocol=NULL;
- }
- efree(protocopy);
+ if(FAILURE==zend_hash_find(&fopen_url_wrappers_hash, protocol, n, (void **)&wrapper)) {
+ wrapper=NULL;
+ protocol=NULL;
}
if(wrapper)
return (*wrapper)(path, mode, options, issock, socketd, opened_path);