summaryrefslogtreecommitdiff
path: root/Zend/zend_qsort.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2013-01-18 13:42:19 -0800
committerStanislav Malyshev <stas@php.net>2013-01-18 13:42:19 -0800
commitcd619b47f378bc45d6f355a096e3733b02f9e5a8 (patch)
treec5ba7943ebb7abd4df2250f17ed6e251488b3377 /Zend/zend_qsort.c
parentdeeacc7106186470f7873b291feaca2e474b3c74 (diff)
parentcd2b03d5ae835d333bec98e62592fd149fef544c (diff)
downloadphp-git-cd619b47f378bc45d6f355a096e3733b02f9e5a8.tar.gz
Merge branch 'PHP-5.5' of git.php.net:php-src into PHP-5.5
* 'PHP-5.5' of git.php.net:php-src: Fixed bug #63988 (Two Date tests fail) only for PHP-5.5 - Fixed ZTS build Dereferencing process-handles no longer waits on those processes. revert change. now it doesn't compile again...someone should fix ext/date... Use two dtors thus allow allocation based on the alloc model of the connection. plug a leak - forgot ot use the dtor already written Revert "Apply the fputcsv test fix to SplFileObject_fputcsv.phpt. Mea culpa." Revert "Update fputcsv() to escape all characters equally." Add support for connect attributes, as of MySQL 5.6 Bug #62489: dba_insert not working as expected UPGRADING.INTERNALS: document zend_qsort_r Add zend_qsort_r & use it in strtr NEWS for bug #63893 Update README.PARAMETER_PARSING_API Export zend_parse_parameter() Expose zend_parse_arg() as zend_parse_parameter() zend_parse_parameters: allow ! for non pointers
Diffstat (limited to 'Zend/zend_qsort.c')
-rw-r--r--Zend/zend_qsort.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Zend/zend_qsort.c b/Zend/zend_qsort.c
index bf179904ef..128c48dfc8 100644
--- a/Zend/zend_qsort.c
+++ b/Zend/zend_qsort.c
@@ -19,6 +19,7 @@
/* $Id$ */
#include "zend.h"
+#include "zend_qsort.h"
#include <limits.h>
@@ -53,7 +54,7 @@ static void _zend_qsort_swap(void *a, void *b, size_t siz)
}
}
-ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC)
+ZEND_API void zend_qsort_r(void *base, size_t nmemb, size_t siz, compare_r_func_t compare, void *arg TSRMLS_DC)
{
void *begin_stack[QSORT_STACK_SIZE];
void *end_stack[QSORT_STACK_SIZE];
@@ -80,10 +81,10 @@ ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t co
seg2 = end;
while (1) {
- for (; seg1 < seg2 && compare(begin, seg1 TSRMLS_CC) > 0;
+ for (; seg1 < seg2 && compare(begin, seg1 TSRMLS_CC, arg) > 0;
seg1 += siz);
- for (; seg2 >= seg1 && compare(seg2, begin TSRMLS_CC) > 0;
+ for (; seg2 >= seg1 && compare(seg2, begin TSRMLS_CC, arg) > 0;
seg2 -= siz);
if (seg1 >= seg2)
@@ -117,6 +118,11 @@ ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t co
}
}
+ZEND_API void zend_qsort(void *base, size_t nmemb, size_t siz, compare_func_t compare TSRMLS_DC)
+{
+ zend_qsort_r(base, nmemb, siz, (compare_r_func_t)compare, NULL TSRMLS_CC);
+}
+
/*
* Local Variables:
* c-basic-offset: 4