summaryrefslogtreecommitdiff
path: root/ext/intl/breakiterator/breakiterator_class.cpp
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-10-07 17:57:49 +0300
committerDmitry Stogov <dmitry@zend.com>2019-10-07 17:57:49 +0300
commitb02b81299ccef7de244bac7ffc605e3d2943fa88 (patch)
treef07036f89b7f4c8f3162f20702881061d59a13a3 /ext/intl/breakiterator/breakiterator_class.cpp
parente2100619ac064fdd4e7fe79e296a2ca087409e7d (diff)
downloadphp-git-b02b81299ccef7de244bac7ffc605e3d2943fa88.tar.gz
Comparison cleanup:
- introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval) - remove compare_objects() object handler, and keep only compare() handler
Diffstat (limited to 'ext/intl/breakiterator/breakiterator_class.cpp')
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 6a9cd85c72..608702ac2b 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -82,6 +82,11 @@ static int BreakIterator_compare_objects(zval *object1,
BreakIterator_object *bio1,
*bio2;
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+ if (Z_TYPE_P(object1) != Z_TYPE_P(object2)) {
+ return 1; /* object and non-object */
+ }
+
bio1 = Z_INTL_BREAKITERATOR_P(object1);
bio2 = Z_INTL_BREAKITERATOR_P(object2);
@@ -318,7 +323,7 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void)
memcpy(&BreakIterator_handlers, &std_object_handlers,
sizeof BreakIterator_handlers);
BreakIterator_handlers.offset = XtOffsetOf(BreakIterator_object, zo);
- BreakIterator_handlers.compare_objects = BreakIterator_compare_objects;
+ BreakIterator_handlers.compare = BreakIterator_compare_objects;
BreakIterator_handlers.clone_obj = BreakIterator_clone_obj;
BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info;
BreakIterator_handlers.free_obj = BreakIterator_objects_free;