示例#1
0
// Remove first node that contains the given data 
void *removeIfExists(List* list, void* data) {
	ListNode *element = list->head;
	while ((element != NULL) && (element->data != data)) {
		element = element->next;
	}
	if (element != NULL) {
		data = unlinkElement(list, element);
	}
	return data;
}
示例#2
0
// remove element at index (0-indexed)
void *removeElement(List *list, int index) {
	void *data = NULL;
	if (index >= list->num_nodes) {
		return data;
	}
	ListNode *element = NULL;
	int i = 0;
	element = list->head;
	while (i++ < index) {
		element = element->next;
	}
	data = unlinkElement(list, element);
	return data;
}
示例#3
0
文件: queue.c 项目: MarkMielke/brltty
void
deleteElement (Element *element) {
  unlinkElement(element);
  discardElement(element);
}
示例#4
0
文件: queue.c 项目: Moeryn/bmc
void
requeueElement (Element *element) {
  unlinkElement(element);
  enqueueElement(element);
}