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
This commit is contained in:
parent
fd5de88682
commit
5811041053
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue