cvs: php4 /scripts/ext_skel_ng php_resource.php

From: Date: Sat, 26 Apr 2003 16:09:06 +0000
Subject: cvs: php4 /scripts/ext_skel_ng php_resource.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20515@lists.php.net to get a copy of this message
hholzgra Sat Apr 26 12:09:06 2003 EDT Modified files: /php4/scripts/ext_skel_ng php_resource.php Log: constructor proto change Index: php4/scripts/ext_skel_ng/php_resource.php diff -u php4/scripts/ext_skel_ng/php_resource.php:1.3 php4/scripts/ext_skel_ng/php_resource.php:1.4 --- php4/scripts/ext_skel_ng/php_resource.php:1.3 Wed Apr 23 12:19:08 2003 +++ php4/scripts/ext_skel_ng/php_resource.php Sat Apr 26 12:08:48 2003 @@ -1,14 +1,20 @@ <?php class php_resource extends php_element { - function php_resource($name, $payload, $alloc, $destruct, $description) { - $this->name = $name; - $this->payload = $payload; - $this->alloc = $alloc; + + function __construct($attr, $destruct, $description) { + $this->name = $attr['name']; + if (!$this->is_name($this->name)) { + $this->error[] = "'$attr[name] is not a valid resource name"; + } + + + $this->payload = @$attr['payload']; + $this->alloc = @$attr['alloc']; $this->destruct = $destruct; $this->description = $description; - if(empty($this->payload)) { + if (empty($this->payload)) { $this->payload = "void"; } } @@ -59,7 +65,7 @@ return " #define {$upname}_FETCH(r, z) ZEND_FETCH_RESOURCE(r, {$this->payload} *, z, -1, ${$this->name}, le_{$this->name }); \ - if(!r) { RETURN_FALSE; } + if (!r) { RETURN_FALSE; } #define {$upname}_REGISTER(r) ZEND_REGISTER_RESOURCE(return_value, r, le_{$this->name }); ";

« previous php.cvs (#20515) next »