Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 22, 2010
1 parent 7bd5fae commit 2f3e7f9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@

## API

### List *List_new();
## List *List_new();

Allocate and initialize a `List`.

List *myList = List_new();

### ListNode \*ListNode_new(void *val)
## ListNode \*ListNode_new(void *val)

Allocate and initialize a `ListNode` with the given _val_.

ListNode *node = ListNode_new("my value");
node->val; // "my value"

### ListNode \* List_push(List \*self, ListNode *node)
## ListNode \* List_push(List \*self, ListNode *node)

Append _node_ to _self_, returning _node_.

List_push(list, ListNode_new("value"));
list->tail->val; // "value"

### ListNode \*List_unshift(List \*self, ListNode *node)
## ListNode \*List_unshift(List \*self, ListNode *node)

Prepend _node_ to _self_, returning _node_.

List_unshift(list, ListNode_new("value"));
list->head->val; // "value"

### ListNode \*List_find(List \*self, void *val)
## ListNode \*List_find(List \*self, void *val)

Return the `ListNode` containing _val_ or __NULL__.

ListNode *node = List_find(list, "some value");

### ListNode \*List_at(List *self, int index)
## ListNode \*List_at(List *self, int index)

Return the `ListNode` at the given _index_, where _index_
may also be a negative integer indicating an index from the
Expand All @@ -49,19 +49,19 @@
List_at(list, -1); // last
List_at(list, -3); // third last

### void List_remove(List \*self, ListNode *node)
## void List_remove(List \*self, ListNode *node)

Remove _node_ from the list.

List_remove(list, node);

### void List_destroy(List *self)
## void List_destroy(List *self)

Free the list and all nodes.

List_destroy(list);

### ListIterator \*ListIterator_new(List *list, ListDirection direction)
## ListIterator \*ListIterator_new(List *list, ListDirection direction)

Allocate and initialize a `ListIterator` with the given _direction_,
where _direction_ may be __LIST_HEAD__ or __LIST_TAIL__.
Expand All @@ -72,11 +72,11 @@
puts(node->val);
}

### ListNode \*ListIterator_next(ListIterator *self)
## ListNode \*ListIterator_next(ListIterator *self)

Return the next `ListNode` or __NULL__.

### void ListIterator_destroy(ListIterator *self);
## void ListIterator_destroy(ListIterator *self);

Free the iterator only.

Expand Down

0 comments on commit 2f3e7f9

Please sign in to comment.