Skip to content
This repository was archived by the owner on Jul 7, 2018. It is now read-only.

Commit e5dcf7a

Browse files
committed
Remove references comparison
It could be implemented in userland when needed. I do not have any good evidence that someone ever used references comparison. Originally it was just an experimental feature, but I do not have time to mainatain things that are not used.
1 parent 76aa39c commit e5dcf7a

File tree

3 files changed

+0
-255
lines changed

3 files changed

+0
-255
lines changed

php_ref_reference.c

-37
Original file line numberDiff line numberDiff line change
@@ -521,42 +521,6 @@ static HashTable *php_ref_get_debug_info(zval *object, int *is_temp)
521521
return debug_info;
522522
}
523523

524-
static int php_ref_compare_objects(zval *object1, zval *object2)
525-
{
526-
zval result;
527-
int res;
528-
529-
PHP_REF_REFERENCE_FETCH_INTO(object1, reference1);
530-
PHP_REF_REFERENCE_FETCH_INTO(object2, reference2);
531-
532-
/* Compare referent objects */
533-
if (NULL == reference1->referent && NULL == reference2->referent) {
534-
/* skip */
535-
} else if(NULL == reference1->referent) {
536-
return 1;
537-
} else if (NULL == reference2->referent) {
538-
return -1;
539-
} else {
540-
res = std_object_handlers.compare_objects(&reference1->referent->this_ptr, &reference2->referent->this_ptr);
541-
542-
if (res != 0) {
543-
return res;
544-
}
545-
}
546-
547-
/* Compare notifiers */
548-
ZVAL_LONG(&result, 0);
549-
550-
compare_function(&result, &reference1->notifier, &reference2->notifier);
551-
552-
if (Z_LVAL(result) != 0) {
553-
return (int) Z_LVAL(result);
554-
}
555-
556-
/* Compare standard objects */
557-
return std_object_handlers.compare_objects(object1, object2);
558-
}
559-
560524
static PHP_METHOD(WeakReference, __construct)
561525
{
562526
zval *referent_zv;
@@ -674,7 +638,6 @@ PHP_MINIT_FUNCTION (php_ref_reference)
674638
php_ref_reference_object_handlers.get_gc = php_ref_reference_gc;
675639
php_ref_reference_object_handlers.clone_obj = php_ref_reference_clone_obj;
676640
php_ref_reference_object_handlers.get_debug_info = php_ref_get_debug_info;
677-
php_ref_reference_object_handlers.compare_objects = php_ref_compare_objects;
678641

679642
INIT_NS_CLASS_ENTRY(ce, PHP_REF_NS, "SoftReference", php_ref_weak_reference_methods);
680643
php_ref_soft_reference_class_entry = zend_register_internal_class_ex(&ce, php_ref_abstract_reference_class_entry);

tests/002-WeakReference-compare.phpt

-108
This file was deleted.

tests/004-SofrReference-compare.phpt

-110
This file was deleted.

0 commit comments

Comments
 (0)