Exemplo n.º 1
0
int
do_round(struct index *idx, struct trace *t)
{
	const char *p;
	void *data;

	trace_foreach(t, p) {
		switch (*p) {
		case '+':
			assert(index_put(idx, p + 1, MAGIC) == 0);
			break;
		case ' ':
			assert(index_get(idx, p + 1, &data) == 0);
			assert(data == MAGIC);
			break;
		case '-':
			assert(index_del(idx, p + 1) == 0);
			break;
		default:
			errx(1, "invalid trace command character (%c)", *p);
		}
	}

	return 0;
}
Exemplo n.º 2
0
Module*
erts_put_module(Eterm mod)
{
    Module e;
    int index;

    ASSERT(is_atom(mod));
    ERTS_SMP_LC_ASSERT(erts_initialized == 0 || erts_smp_is_system_blocked(0));
    e.module = atom_val(mod);
    index = index_put(&module_table, (void*) &e);
    return (Module*) erts_index_lookup(&module_table, index);
}