Sha256: 3b97c1d4c774c0d510b6cce9a1c81023d6bb585ccfa6bec5cc017163ec7c28b0

Contents?: true

Size: 765 Bytes

Versions: 39

Compression:

Stored size: 765 Bytes

Contents

#include <stdlib.h>

#include "cmark.h"

cmark_llist *cmark_llist_append(cmark_mem *mem, cmark_llist *head, void *data) {
  cmark_llist *tmp;
  cmark_llist *new_node = (cmark_llist *) mem->calloc(1, sizeof(cmark_llist));

  new_node->data = data;
  new_node->next = NULL;

  if (!head)
    return new_node;

  for (tmp = head; tmp->next; tmp=tmp->next);

  tmp->next = new_node;

  return head;
}

void cmark_llist_free_full(cmark_mem *mem, cmark_llist *head, cmark_free_func free_func) {
  cmark_llist *tmp, *prev;

  for (tmp = head; tmp;) {
    if (free_func)
      free_func(mem, tmp->data);

    prev = tmp;
    tmp = tmp->next;
    mem->free(prev);
  }
}

void cmark_llist_free(cmark_mem *mem, cmark_llist *head) {
  cmark_llist_free_full(mem, head, NULL);
}

Version data entries

39 entries across 38 versions & 2 rubygems

Version Path
commonmarker-0.16.2 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.16.3 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.16.0 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.15.0 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.15 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.14 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.13 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.12 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.11 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.9 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.8 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.7 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.6 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.5 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.4 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.3 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.2 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.1 ext/commonmarker/cmark/src/linked_list.c
commonmarker-0.14.0 ext/commonmarker/cmark/src/linked_list.c