summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/edje/src/lib/edje_match.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/legacy/edje/src/lib/edje_match.c b/legacy/edje/src/lib/edje_match.c
index b398e5dc67..273d2ace41 100644
--- a/legacy/edje/src/lib/edje_match.c
+++ b/legacy/edje/src/lib/edje_match.c
@@ -68,7 +68,7 @@ _edje_match_states_alloc(Edje_Patterns *ppat, int n)
68 ALIGN(struct_size); 68 ALIGN(struct_size);
69 struct_size += states_has_size; 69 struct_size += states_has_size;
70 70
71 l = malloc(n * struct_size); 71 l = calloc(1, n * struct_size);
72 if (!l) return 0; 72 if (!l) return 0;
73 73
74 ppat->states = l; 74 ppat->states = l;
@@ -92,19 +92,21 @@ _edje_match_states_insert(Edje_States *list,
92 size_t idx, 92 size_t idx,
93 size_t pos) 93 size_t pos)
94{ 94{
95 { 95 size_t i;
96 const size_t i = idx * (patterns_max_length + 1) + pos;
97
98 if (list->size > i && list->has[i]) return;
99 list->has[i] = 1;
100 }
101
102 const size_t i = list->size;
103 96
97 i = (idx * (patterns_max_length + 1)) + pos;
98
99 if (list->size > i)
100 {
101 if (list->has[i]) return;
102 }
103 list->has[i] = 1;
104
105 i = list->size;
104 list->states[i].idx = idx; 106 list->states[i].idx = idx;
105 list->states[i].pos = pos; 107 list->states[i].pos = pos;
106 list->has[i] = 0; 108 list->has[i] = 0;
107 ++list->size; 109 list->size++;
108} 110}
109 111
110static void 112static void
@@ -118,11 +120,11 @@ _edje_match_states_clear(Edje_States *list,
118/* Token manipulation. */ 120/* Token manipulation. */
119 121
120enum status 122enum status
121 { 123{
122 patterns_not_found = 0, 124 patterns_not_found = 0,
123 patterns_found = 1, 125 patterns_found = 1,
124 patterns_syntax_error = 2 126 patterns_syntax_error = 2
125 }; 127};
126 128
127static size_t 129static size_t
128_edje_match_patterns_exec_class_token(enum status *status, 130_edje_match_patterns_exec_class_token(enum status *status,