Sha256: c8453f92186a241912c69ee355418a5a94a95432a13652d26e4e1d45eb7765ec

Contents?: true

Size: 1009 Bytes

Versions: 27

Compression:

Stored size: 1009 Bytes

Contents

#include "cmark-gfm.h"
#include "parser.h"
#include "footnotes.h"
#include "inlines.h"
#include "chunk.h"

static void footnote_free(cmark_map *map, cmark_map_entry *_ref) {
  cmark_footnote *ref = (cmark_footnote *)_ref;
  cmark_mem *mem = map->mem;
  if (ref != NULL) {
    mem->free(ref->entry.label);
    if (ref->node)
      cmark_node_free(ref->node);
    mem->free(ref);
  }
}

void cmark_footnote_create(cmark_map *map, cmark_node *node) {
  cmark_footnote *ref;
  unsigned char *reflabel = normalize_map_label(map->mem, &node->as.literal);

  /* empty footnote name, or composed from only whitespace */
  if (reflabel == NULL)
    return;

  assert(map->sorted == NULL);

  ref = (cmark_footnote *)map->mem->calloc(1, sizeof(*ref));
  ref->entry.label = reflabel;
  ref->node = node;
  ref->entry.age = map->size;
  ref->entry.next = map->refs;

  map->refs = (cmark_map_entry *)ref;
  map->size++;
}

cmark_map *cmark_footnote_map_new(cmark_mem *mem) {
  return cmark_map_new(mem, footnote_free);
}

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
commonmarker-0.23.1 ext/commonmarker/footnotes.c
markly-0.6.1 ext/markly/footnotes.c
commonmarker-0.23.0 ext/commonmarker/footnotes.c
markly-0.6.0 ext/markly/footnotes.c
commonmarker-0.22.0 ext/commonmarker/footnotes.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/commonmarker-0.21.2/ext/commonmarker/footnotes.c
commonmarker-0.21.2 ext/commonmarker/footnotes.c
commonmarker-0.21.1 ext/commonmarker/footnotes.c
markly-0.5.2 ext/markly/footnotes.c
markly-0.5.1 ext/markly/footnotes.c
markly-0.5.0 ext/markly/footnotes.c
markly-0.4.0 ext/markly/footnotes.c
markly-0.3.0 ext/markly/footnotes.c
markly-0.2.2 ext/markly/footnotes.c
markly-0.2.1 ext/markly/footnotes.c
markly-0.2.0 ext/markly/footnotes.c
markly-0.1.0 ext/markly/footnotes.c
commonmarker-0.21.0 ext/commonmarker/footnotes.c
commonmarker-0.20.2 ext/commonmarker/footnotes.c
commonmarker-0.20.1 ext/commonmarker/footnotes.c