+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
+Tue May 7 11:24:22 2002 Owen Taylor <otaylor@redhat.com>
+
+ Fixes for #79347, Ron Arts.
+
+ * glib/gqsort.c (g_qsort_with_data): Handle 0 elements,
+ don't g_return_if_fail().
+
+ * tests/qsort-test.c (main): Add a 0 element test.
+
+ * glib/garray.c (g_[ptr_]array_sort_with[_data]):
+ Remove invalid assertions that array->pdata != NULL ..
+ it's NULL for 0 elements which is a valid case.
+
Mon May 6 16:00:41 2002 Owen Taylor <otaylor@redhat.com>
* glib/gbacktrace.h: Exclude OSF from alpha definition
GRealArray *array = (GRealArray*) farray;
g_return_if_fail (array != NULL);
- g_return_if_fail (array->data != NULL);
qsort (array->data,
array->len,
GRealArray *array = (GRealArray*) farray;
g_return_if_fail (array != NULL);
- g_return_if_fail (array->data != NULL);
g_qsort_with_data (array->data,
array->len,
GCompareFunc compare_func)
{
g_return_if_fail (array != NULL);
- g_return_if_fail (array->pdata != NULL);
qsort (array->pdata,
array->len,
gpointer user_data)
{
g_return_if_fail (array != NULL);
- g_return_if_fail (array->pdata != NULL);
g_qsort_with_data (array->pdata,
array->len,
char *pivot_buffer = (char *) g_alloca (size);
const size_t max_thresh = MAX_THRESH * size;
- g_return_if_fail (total_elems > 0);
- g_return_if_fail (pbase != NULL);
+ g_return_if_fail (total_elems >= 0);
+ g_return_if_fail (pbase != NULL || total_elems == 0);
g_return_if_fail (compare_func != NULL);
+ if (total_elems == 0)
+ return;
+
if (total_elems > MAX_THRESH)
{
char *lo = base_ptr;
for (i = 0; i < SIZE - 1; i++)
g_assert (array[i] <= array[i+1]);
+ /* 0 elemenents is a valid case */
+ g_qsort_with_data (array, 0, sizeof (guint32), sort, NULL);
+
return 0;
}