Hello All,
After reviewing Christian Dickmann's list of functions with broken
prototypes, I have started making corrections where needed.
Given that I am not sure that everyone will agree that these changes
are needed (or that I will make the changes properly FTM), I am
starting slowly. :)
The attached patch corrects the proto, improves the proto description
and makes the function return FALSE when it encounters an error.
Feedback is welcome!
I realize that someone more skilled could do this work about 20x
faster. However, I would like to tackle small tasks like this to get
more familiar with the source. :)
--
Zak Greant
PHP Quality Assurance Team
http://qa.php.net/
"We must be the change we wish to see." - M. K. Ghandi
Index: ext/standard/array.c
===================================================================
RCS file: /repository/php4/ext/standard/array.c,v
retrieving revision 1.148
diff -u -r1.148 array.c
--- ext/standard/array.c 11 Dec 2001 15:30:27 -0000 1.148
+++ ext/standard/array.c 12 Dec 2001 01:44:22 -0000
@@ -179,8 +179,8 @@
return array_key_compare(a, b TSRMLS_CC) * -1;
}
-/* {{{ proto int krsort(array array_arg [, int sort_flags])
- Sort an array reverse by key */
+/* {{{ proto bool krsort(array array_arg [, int sort_flags])
+ Sort an array by key value in reverse order */
PHP_FUNCTION(krsort)
{
zval **array, **sort_type;
@@ -194,7 +194,7 @@
target_hash = HASH_OF(*array);
if (!target_hash) {
php_error(E_WARNING, "Wrong datatype in krsort() call");
- return;
+ RETURN_FALSE
}
if (ZEND_NUM_ARGS() == 2) {
convert_to_long_ex(sort_type);
@@ -202,7 +202,7 @@
}
set_compare_func(sort_type_val TSRMLS_CC);
if (zend_hash_sort(target_hash, zend_qsort, array_reverse_key_compare, 0 TSRMLS_CC) == FAILURE) {
- return;
+ RETURN_FALSE;
}
RETURN_TRUE;
}
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]