From 581104105397a5826a152e41f35bd23370bf864e Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 11 Sep 2008 11:20:42 +0000 Subject: [PATCH] This patch reduce the usage of memset by edje_match function. I did test this patch since three month in my apps and in E, and I didn't notice anything going wrong with it. If you experience strange bug with matching please report them. SVN revision: 35945 --- legacy/edje/src/lib/edje_match.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/legacy/edje/src/lib/edje_match.c b/legacy/edje/src/lib/edje_match.c index 2fa8dda20a..0c03d8a7a5 100644 --- a/legacy/edje/src/lib/edje_match.c +++ b/legacy/edje/src/lib/edje_match.c @@ -67,10 +67,12 @@ _edje_match_states_alloc(Edje_Patterns *ppat, int n) ALIGN(struct_size); struct_size += states_has_size; - l = calloc(1, n * struct_size); + l = malloc(n * struct_size); if (!l) return 0; ppat->states = l; + ppat->states->size = 0; + states = (unsigned char *) (l + n); has = states + states_size; @@ -78,6 +80,9 @@ _edje_match_states_alloc(Edje_Patterns *ppat, int n) { l[i].states = (Edje_State *) states; l[i].has = (_Bool *) has; + + memset(l[i].has, 0, has_size); + states += states_has_size; has += states_has_size; } @@ -95,7 +100,7 @@ _edje_match_states_insert(Edje_States *list, i = (idx * (patterns_max_length + 1)) + pos; - if (list->size > i) + if (i < list->size) { if (list->has[i]) return; }