@@ -698,19 +698,6 @@ static void php_free_xpath_context(zend_rsrc_list_entry *rsrc TSRMLS_DC)
698
698
xmlXPathFreeContext (ctx );
699
699
}
700
700
}
701
-
702
- static void php_free_xpath_object (zend_rsrc_list_entry * rsrc TSRMLS_DC )
703
- {
704
- xmlXPathObjectPtr obj = (xmlXPathObjectPtr ) rsrc -> ptr ;
705
-
706
- if (obj ) {
707
- if (obj -> user ) {
708
- zval * wrapper = obj -> user ;
709
- zval_ptr_dtor (& wrapper );
710
- }
711
- xmlXPathFreeObject (obj );
712
- }
713
- }
714
701
#endif
715
702
716
703
static void php_free_xml_parser (zend_rsrc_list_entry * rsrc TSRMLS_DC )
@@ -843,79 +830,12 @@ void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_
843
830
return obj ;
844
831
}
845
832
846
-
847
- static void xpath_object_set_data (void * obj , zval * wrapper )
848
- {
849
- /*
850
- char tmp[20];
851
- sprintf(tmp, "%08X", obj);
852
- fprintf(stderr, "Adding %s to hash\n", tmp);
853
- */
854
- ((xmlXPathObjectPtr ) obj )-> user = wrapper ;
855
- }
856
-
857
-
858
- static zval * xpath_object_get_data (void * obj )
859
- {
860
- /*
861
- char tmp[20];
862
- sprintf(tmp, "%08X", obj);
863
- fprintf(stderr, "Trying getting %s from hash ...", tmp);
864
- if(((xmlXPathObjectPtr) obj)->user)
865
- fprintf(stderr, " found\n");
866
- else
867
- fprintf(stderr, " not found\n");
868
- */
869
- return ((zval * ) (((xmlXPathObjectPtr ) obj )-> user ));
870
- }
871
-
872
-
873
- static void php_xpath_set_object (zval * wrapper , void * obj , int rsrc_type )
874
- {
875
- zval * handle , * addr ;
876
-
877
- MAKE_STD_ZVAL (handle );
878
- Z_TYPE_P (handle ) = IS_LONG ;
879
- Z_LVAL_P (handle ) = zend_list_insert (obj , rsrc_type );
880
-
881
- MAKE_STD_ZVAL (addr );
882
- Z_TYPE_P (addr ) = IS_LONG ;
883
- Z_LVAL_P (addr ) = (int ) obj ;
884
-
885
- zend_hash_index_update (Z_OBJPROP_P (wrapper ), 0 , & handle , sizeof (zval * ), NULL );
886
- zend_hash_index_update (Z_OBJPROP_P (wrapper ), 1 , & addr , sizeof (zval * ), NULL );
887
- zval_add_ref (& wrapper );
888
- xpath_object_set_data (obj , wrapper );
889
- }
890
-
891
833
static zval * php_xpathobject_new (xmlXPathObjectPtr obj , int * found TSRMLS_DC )
892
834
{
893
835
zval * wrapper ;
894
836
895
- * found = 0 ;
896
-
897
- if (!obj ) {
898
- MAKE_STD_ZVAL (wrapper );
899
- ZVAL_NULL (wrapper );
900
- return wrapper ;
901
- }
902
-
903
- if ((wrapper = (zval * ) xpath_object_get_data ((void * ) obj ))) {
904
- zval_add_ref (& wrapper );
905
- * found = 1 ;
906
- return wrapper ;
907
- }
908
-
909
837
MAKE_STD_ZVAL (wrapper );
910
838
object_init_ex (wrapper , xpathobject_class_entry );
911
-
912
- /*
913
- rsrc_type = le_xpathobjectp;
914
- php_xpath_set_object(wrapper, (void *) obj, rsrc_type);
915
- */
916
-
917
- php_xpath_set_object (wrapper , (void * ) obj , le_xpathobjectp );
918
-
919
839
return (wrapper );
920
840
}
921
841
@@ -1575,7 +1495,7 @@ PHP_MINIT_FUNCTION(domxml)
1575
1495
1576
1496
#if defined(LIBXML_XPATH_ENABLED )
1577
1497
le_xpathctxp = zend_register_list_destructors_ex (php_free_xpath_context , NULL , "xpathcontext" , module_number );
1578
- le_xpathobjectp = zend_register_list_destructors_ex (php_free_xpath_object , NULL , "xpathobject" , module_number );
1498
+ le_xpathobjectp = zend_register_list_destructors_ex (NULL , NULL , "xpathobject" , module_number );
1579
1499
#endif
1580
1500
1581
1501
/* le_domxmlnsp = register_list_destructors(NULL, NULL); */
@@ -4853,6 +4773,7 @@ static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr)
4853
4773
break ;
4854
4774
}
4855
4775
4776
+ xmlXPathFreeObject (xpathobjp );
4856
4777
* return_value = * rv ;
4857
4778
FREE_ZVAL (rv );
4858
4779
}
0 commit comments