예제 #1
0
파일: list.c 프로젝트: dsmrd/dsmrd
/*@null@*/ static node_t list_get_node_by_value(list_t inst, void* val) {
	node_t n = inst->head;
	int ctr = 0;
	while ((n != NULL) && (inst->cmp(node_get_value(n), val))) {
		ctr++;
		n = n->next;
	}
	return n;
}
예제 #2
0
파일: list.c 프로젝트: dsmrd/dsmrd
int list_index_of(list_t inst, void* val) {
	node_t n = inst->head;
	int rval = 0;
	while ((n != NULL) && (inst->cmp(node_get_value(n), val))) {
		rval++;
		n = n->next;
	}
	if (n == NULL) {
		rval = -1;
	}
	return rval;
}