For that matter, use elements as a filter for elements we care about, and
let the hook implement whatever it needs without duplicating everything.
The resulting algorithm is still O(n²) where n is the number of filtered
elements (3 at most right now), which isn't bad if we don't need to get
too many elements, but at least it's not quadratic in the number of
attributes anymore.
Speedup improvements could be done using gperf btw.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
We have a stack, don't be ashamed to use it.
Instead of:
foo_t *foo;
foo = foo_new();
/* work with foo */
foo_delete(&foo);
It's way better to:
foo_t foo;
foo_init(&foo);
/* work with &foo */
foo_wipe(&foo);
Remember: more mallocs == more fragmentation.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>