libdom
Loading...
Searching...
No Matches
list.c File Reference
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <dom/core/string.h>
#include <dom/core/node.h>
#include "comparators.h"
#include "list.h"
#include "domtsasserts.h"

Functions

struct list_eltlist_new_elt (void *data)
 
struct listlist_new (TYPE type)
 
void list_destroy (struct list *list)
 
void list_add (struct list *list, void *data)
 
bool list_remove (struct list *list, void *data)
 
struct listlist_clone (struct list *list)
 
bool list_contains (struct list *list, void *data, comparator comparator)
 
bool list_contains_all (struct list *superList, struct list *subList, comparator comparator)
 

Function Documentation

◆ list_add()

void list_add ( struct list * list,
void * data )

Add data to the tail of the list.

◆ list_clone()

struct list * list_clone ( struct list * list)

◆ list_contains()

bool list_contains ( struct list * list,
void * data,
comparator comparator )

Tests if data is equal to any element in the list.

◆ list_contains_all()

bool list_contains_all ( struct list * superList,
struct list * subList,
comparator comparator )

Tests if superlist contains all elements in sublist. Order is not important.

◆ list_destroy()

void list_destroy ( struct list * list)

◆ list_new()

struct list * list_new ( TYPE type)

◆ list_new_elt()

struct list_elt * list_new_elt ( void * data)

Private helper function. Create a new list_elt and initialise it.

◆ list_remove()

bool list_remove ( struct list * list,
void * data )

Remove element containing data from list. The list element is freed, but the caller must free the data itself if necessary.

Returns true if data was found in the list.