if (!f->name)
prepare_function(f, fpath);
- b->name = strdup(f->name);
- if (b->name == NULL)
- fail();
- free_later(b->name);
+ if (!b->name) {
+ b->name = strdup(f->name);
+ if (b->name == NULL)
+ fail();
+ free_later(b->name);
+ }
b->target = f;
}
int tmp;
int count = 0;
struct test_function *f;
+ struct test_binding *b;
int i;
tmp = asprintf(&c->name, "%s.%d",
c->path = cpath;
- for (f = c->bound_funcs; f->instance; f++)
- count++;
+ /* check if bindings has been already filled */
+ if (!c->bindings) {
+ for (f = c->bound_funcs; f->instance; f++)
+ count++;
- c->bindings = calloc(count + 1, sizeof(*c->bindings));
- if (c->bindings == NULL)
- fail();
- free_later(c->bindings);
+ c->bindings = calloc(count + 1, sizeof(*c->bindings));
+ if (c->bindings == NULL)
+ fail();
+ free_later(c->bindings);
+ } else {
+ for (b = c->bindings; b->name; b++)
+ count++;
+ }
for (i = 0; i < count; i++)
prepare_binding(&c->bindings[i], &c->bound_funcs[i], fpath);