From 1b66ba17ad96518ce100c0a27f7f5a11a4cd1668 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 2 Jul 2018 18:29:17 +0200 Subject: Remove unnecessary explicit argc check Instead specify a default value for the argument, which is more idiomatic. --- ext/reflection/php_reflection.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 20711bc7ed..144714b47a 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4185,16 +4185,10 @@ ZEND_METHOD(reflection_class, getMethods) { reflection_object *intern; zend_class_entry *ce; - zend_long filter = 0; - int argc = ZEND_NUM_ARGS(); + zend_long filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC; - if (argc) { - if (zend_parse_parameters(argc, "|l", &filter) == FAILURE) { - return; - } - } else { - /* No parameters given, default to "return all" */ - filter = ZEND_ACC_PPP_MASK | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL | ZEND_ACC_STATIC; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &filter) == FAILURE) { + return; } GET_REFLECTION_OBJECT_PTR(ce); @@ -4377,16 +4371,10 @@ ZEND_METHOD(reflection_class, getProperties) { reflection_object *intern; zend_class_entry *ce; - zend_long filter = 0; - int argc = ZEND_NUM_ARGS(); + zend_long filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC; - if (argc) { - if (zend_parse_parameters(argc, "|l", &filter) == FAILURE) { - return; - } - } else { - /* No parameters given, default to "return all" */ - filter = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &filter) == FAILURE) { + return; } GET_REFLECTION_OBJECT_PTR(ce); -- cgit v1.2.1