Esempio n. 1
0
// useful for debugging
static void dump(const Episode& episode, const Table_Enc2Obj& enc2obj, std::ostream& out = std::cout, std::string(*oid2str)(OID_t) = NULL)
{
    for (Episode::const_iterator it = episode.begin(); it != episode.end(); ++it) {
        enc_t code = *it;
        OID_t id = enc2obj.find(code)->second->get_oid();
        out << id << "\t";

        for (enc_t b = 1 << 31; b; b >>= 1) {
            out << (code & b ? 1 : 0);
        }

        if (oid2str) {
            out << "\t" << oid2str(id);
        }

        out << std::endl;
    }
}
Esempio n. 2
0
int
free_oid_info_list(struct oid_info_head *list)
{
	struct oid_info *n1, *n2;

	n1 = TAILQ_FIRST(list);
	while (n1 != NULL) {
		n2 = TAILQ_NEXT(n1, oid_list);
if (0){
fprintf(stderr, "       freeing an oid (C:%u,S:%u) %s\n", n1->cid, n1->sid, oid2str(n1->oid));
}
		free(n1->oid.buf);
		free(n1->value.buf);
		PS.active_oid_infos--;
		free(n1);
		n1 = n2;
	}
	TAILQ_INIT(list);
	return 1;
}