Time to dump all my pending patch again :) Starting with the easy one :
- edje-const.diff and evas-const.diff: Add some const, useless :)
- evas-list-sort.diff: I did finally find a bug with some size, the end of the
list was not correctly sorted. Could be the bug raster see in my early patch
(I also attached the test I used to find that issue).
Well, more work is coming...
Cedric
diff -Nrua -X exclude.cvs e17-clean/libs/edje/src/lib/Edje.h e17-dev/libs/edje/src/lib/Edje.h
--- e17-clean/libs/edje/src/lib/Edje.h 2007-06-04 09:17:09.000000000 +0200
+++ e17-dev/libs/edje/src/lib/Edje.h 2007-06-08 17:09:11.000000000 +0200
@@ -164,7 +164,7 @@
/* edje_util.c */
EAPI void edje_freeze (void);
EAPI void edje_thaw (void);
- EAPI void edje_fontset_append_set (char *fonts);
+ EAPI void edje_fontset_append_set (const char *fonts);
EAPI const char *edje_fontset_append_get (void);
/* edje_load.c */
diff -Nrua -X exclude.cvs e17-clean/libs/edje/src/lib/edje_util.c e17-dev/libs/edje/src/lib/edje_util.c
--- e17-clean/libs/edje/src/lib/edje_util.c 2007-06-20 13:46:54.000000000 +0200
+++ e17-dev/libs/edje/src/lib/edje_util.c 2007-06-18 15:22:33.000000000 +0200
@@ -58,7 +58,7 @@
/* FIXDOC: Expand */
EAPI void
-edje_fontset_append_set(char *fonts)
+edje_fontset_append_set(const char *fonts)
{
if (_edje_fontset_append)
free(_edje_fontset_append);
diff -Nrua -X exclude.cvs e17-clean/libs/evas/src/lib/data/evas_list.c e17-dev/libs/evas/src/lib/data/evas_list.c
--- e17-clean/libs/evas/src/lib/data/evas_list.c 2007-03-20 18:54:27.000000000 +0100
+++ e17-dev/libs/evas/src/lib/data/evas_list.c 2007-05-21 13:51:31.000000000 +0200
@@ -850,57 +850,8 @@
if (l1 == l2) break;
l2 = l2->prev;
}
- return list;
-}
-
-static Evas_List *
-evas_list_combine(Evas_List *l, Evas_List *ll, int (*func)(void *, void*))
-{
- Evas_List *result = NULL;
- Evas_List *l_head = NULL, *ll_head = NULL;
-
- l_head = l;
- ll_head = ll;
- while (l && ll)
- {
- int cmp;
- cmp = func(l->data, ll->data);
- if (cmp < 0)
- {
- result = evas_list_append(result, l->data);
- l = evas_list_next(l);
- }
- else if (cmp == 0)
- {
- result = evas_list_append(result, l->data);
- l = evas_list_next(l);
- result = evas_list_append(result, ll->data);
- ll = evas_list_next(ll);
- }
- else if (cmp > 0)
- {
- result = evas_list_append(result, ll->data);
- ll = evas_list_next(ll);
- }
- else
- {
- l = ll = NULL;
- }
- }
- while (l)
- {
- result = evas_list_append(result, l->data);
- l = evas_list_next(l);
- }
- evas_list_free(l_head);
- while (ll)
- {
- result = evas_list_append(result, ll->data);
- ll = evas_list_next(ll);
- }
- evas_list_free(ll_head);
- return (result);
+ return list;
}
/**
@@ -915,8 +866,6 @@
* you just have to be smart enough to know what kind of data is in your
* lists
*
- * In the event of a memory allocation failure, It might segv.
- *
* Example:
* @code
* int
@@ -944,41 +893,97 @@
EAPI Evas_List *
evas_list_sort(Evas_List *list, int size, int (*func)(void *, void *))
{
- Evas_List *l = NULL, *ll = NULL, *llast;
- int mid;
+ unsigned int list_number;
+ unsigned int middle;
+ int list_size;
if (!list || !func)
return NULL;
- /* FIXME: this is really inefficient - calling evas_list_nth is not
- * fast as it has to walk the list */
-
/* if the caller specified an invalid size, sort the whole list */
if ((size <= 0) ||
(size > ((Evas_List_Accounting *)(list->accounting))->count))
size = ((Evas_List_Accounting *)(list->accounting))->count;
- mid = size / 2;
- if (mid < 1) return list;
+ middle = size - size / 2;
- /* bleh evas list splicing */
- llast = ((Evas_List_Accounting *)(list->accounting))->last;
- ll = evas_list_nth_list(list, mid);
- if (ll->prev)
+ for (list_number = middle, list_size = 1;
+ list_size < middle * 2;
+ list_number >>= 1, list_size <<= 1)
{
- ((Evas_List_Accounting *)(list->accounting))->last = ll->prev;
- ((Evas_List_Accounting *)(list->accounting))->count = mid;
- ll->prev->next = NULL;
- ll->prev = NULL;
+ Evas_List *head1 = list;
+ unsigned int limit = size;
+ unsigned int process_list;
+ unsigned int pass_number;
+ unsigned int split_size = list_size;
+
+ for (process_list = 0; process_list < list_number + 1; ++process_list)
+ {
+ Evas_List *head2;
+ unsigned int size_sum;
+ int size1, size2;
+ int i;
+
+ size1 = limit < split_size ? limit : split_size;
+ limit -= size1;
+
+ size2 = limit < split_size ? limit : split_size;
+ limit -= size2;
+
+ size_sum = size1 + size2;
+
+ for (head2 = head1, i = 0; i < size1; ++i)
+ head2 = evas_list_next (head2);
+
+ for (pass_number = 0; pass_number < size_sum; ++pass_number)
+ {
+ Evas_List *next;
+ Evas_List *prev1;
+ Evas_List *prev2;
+
+ if (size1 == 0 || head1 == NULL) /* List1 is empty, head1 is already at the end of the list. So only need to update head2 */
+ {
+ for (; pass_number < size_sum; ++pass_number)
+ head2 = evas_list_next (head2);
+ break;
+ }
+ else
+ if (size2 == 0 || head2 == NULL) /* List2 is empty, just leave */
+ break;
+ else
+ if (func (head1->data, head2->data) < 0)
+ {
+ head1 = evas_list_next (head1);
+ --size1;
+ }
+ else
+ {
+ next = evas_list_next (head2);
+ prev1 = evas_list_prev (head1);
+ prev2 = evas_list_prev (head2);
+
+ if (next)
+ next->prev = prev2;
+ if (prev1)
+ prev1->next = head2;
+ if (prev2)
+ prev2->next = next;
+
+ head2->prev = prev1;
+ head2->next = head1;
+ head1->prev = head2;
+
+ --size2;
+
+ if (head1 == list)
+ list = head2;
+
+ head2 = next;
+ }
+ }
+ head1 = head2;
+ }
}
- ll->accounting = evas_mempool_malloc(&_evas_list_accounting_mempool, sizeof(Evas_List_Accounting));
- ((Evas_List_Accounting *)(ll->accounting))->last = llast;
- ((Evas_List_Accounting *)(ll->accounting))->count = size - mid;
-
- /* merge sort */
- l = evas_list_sort(list, mid, func);
- ll = evas_list_sort(ll, size - mid, func);
- list = evas_list_combine(l, ll, func);
return(list);
}
diff -Nrua -X exclude.cvs e17-clean/libs/evas/src/lib/engines/common/evas_blit_main.c e17-dev/libs/evas/src/lib/engines/common/evas_blit_main.c
--- e17-clean/libs/evas/src/lib/engines/common/evas_blit_main.c 2007-03-20 18:54:30.000000000 +0100
+++ e17-dev/libs/evas/src/lib/engines/common/evas_blit_main.c 2007-06-12 14:55:24.000000000 +0200
@@ -24,7 +24,7 @@
}
EAPI void
-evas_common_blit_rectangle(RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y)
+evas_common_blit_rectangle(const RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y)
{
int y;
Gfx_Func_Copy func;
diff -Nrua -X exclude.cvs e17-clean/libs/evas/src/lib/include/evas_common.h e17-dev/libs/evas/src/lib/include/evas_common.h
--- e17-clean/libs/evas/src/lib/include/evas_common.h 2007-06-20 13:46:55.000000000 +0200
+++ e17-dev/libs/evas/src/lib/include/evas_common.h 2007-06-19 11:59:35.000000000 +0200
@@ -993,7 +1103,7 @@
/****/
EAPI void evas_common_blit_init (void);
-EAPI void evas_common_blit_rectangle (RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y);
+EAPI void evas_common_blit_rectangle (const RGBA_Image *src, RGBA_Image *dst, int src_x, int src_y, int w, int h, int dst_x, int dst_y);
/****/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <Evas.h>
int
main(int argc, char** argv)
{
Evas_List* lst = NULL;
char* prev = NULL;
int i;
int j;
int k;
int count;
srand(time());
count = 0;
/* for (j = 0; j < 20000; ++j) */
/* { */
j = 10011;
for (k = 0; k < 10; ++k)
{
for (i = 0; i < j; ++i)
{
char* str;
str = malloc(sizeof(char) * 3);
snprintf(str, 3, "%c%c", rand() % 26 + 'a', rand() % 26 + 'a');
lst = evas_list_append(lst, str);
}
lst = evas_list_sort(lst, evas_list_count(lst), strcmp);
count++;
if (evas_list_count(lst) != j)
printf("%i != %i\n", evas_list_count(lst), j);
for (i = evas_list_count(lst); i > 0; --i)
{
if (prev != NULL)
if (strcmp(prev, evas_list_data(lst)) > 0)
{
printf("%i: %s > %s [j == %i, k == %i]\n", i, prev, evas_list_data(lst), j, k);
}
if (prev) free(prev);
prev = evas_list_data(lst);
lst = evas_list_remove_list(lst, lst);
}
prev = NULL;
printf("done %i tests\n", count);
}
/* } */
return 0;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel