Ejemplo n.º 1
0
static void test_otrl_instag_forget(void)
{
	OtrlInsTag* instag1 = calloc(1, sizeof(OtrlInsTag));
	OtrlInsTag* instag2 = calloc(1, sizeof(OtrlInsTag));

	instag1->tous = &instag1;
	instag1->accountname = strdup("name one");
	instag1->protocol = strdup("protocol one");
	instag1->next = instag2;
	instag1->next->tous = &(instag1->next);
	instag2->accountname = strdup("name two");
	instag2->protocol = strdup("protocol two");

	otrl_instag_forget(NULL);
	ok(1, "Forget on NULL didn't segfault");

	otrl_instag_forget(instag2);
	ok(instag1->next == NULL, "Instag forgotten without segfault");

	free(instag1);
}
Ejemplo n.º 2
0
Archivo: instag.c Proyecto: Ri0n/libotr
/* Forget all instags in a given OtrlUserState. */
void otrl_instag_forget_all(OtrlUserState us) {
    while(us->instag_root) {
	otrl_instag_forget(us->instag_root);
    }
}