Re: zend api question
| From: | Thies C. Arntzen | Date: | Tue, 10 Aug 1999 13:43:49 +0000 |
| Subject: | Re: zend api question | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-9717@lists.php.net to get a copy of this message | ||
hi uwe,
- to the best of my knowledge -
array_init() and object_init_ex() won't touch the refcount stuff (which is
not needed for array_init(return_value)).
to create a *new* zval use MAKE_STD_ZVAL/INIT_PZVAL those function will do
the desired.
so just say:
zval *child;
MAKE_STD_ZVAL(child);
...
tc
PS: i've been thinking of a DOM like thing myself - and i was considering
using libwww instead of pure expat (to be able to parse HTML and XML) -
what do you think?
On Tue, 10 Aug 1999, Uwe Steinmann wrote:
> Hi,
>
> I have started to add another xml module (close to the DOM interface)
> to php4.
>
> When I tried to create an array of objects I realized that
> I have to call INIT_PZVAL() on each object which is not
> needed for the array. I wonder what INIT_PZVAL() is
> for and why it isn't called in object_init[_ex]() ?
>
> Here is my to code to accomplish the above. Does this make sense?
>
> if (array_init(return_value) == FAILURE) {
> RETURN_FALSE;
> }
>
> while(last) {
> zval *child;
> child = (zval *) emalloc(sizeof(zval));
>
> ret = php3_list_insert(last, le_domxmlnodep);
>
> /* construct a node object */
> object_init_ex(child, domxmlnode_class_entry_ptr);
> add_property_stringl(child, "name", last->name,
> strlen(last->name), 1);
> add_property_long(child, "node", ret);
> INIT_PZVAL(child);
> zend_hash_next_index_insert(return_value->value.ht, &child, sizeof(zval
> *), NULL);
> last = last->next;
> }
>
> Uwe
> --
> Uwe.Steinmann@fernuni-hagen.de
> Tel: +2331 987 4528 Fax: +2331 987 375
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany