Sha256: d6dad97ae76e4dec244fb978f3e987223dad28c1aef5999459b8d758b6a6cada

Contents?: true

Size: 1.15 KB

Versions: 43

Compression:

Stored size: 1.15 KB

Contents

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

static void reference_free(cmark_map *map, cmark_map_entry *_ref) {
  cmark_reference *ref = (cmark_reference *)_ref;
  cmark_mem *mem = map->mem;
  if (ref != NULL) {
    mem->free(ref->entry.label);
    cmark_chunk_free(mem, &ref->url);
    cmark_chunk_free(mem, &ref->title);
    mem->free(ref);
  }
}

void cmark_reference_create(cmark_map *map, cmark_chunk *label,
                            cmark_chunk *url, cmark_chunk *title) {
  cmark_reference *ref;
  unsigned char *reflabel = normalize_map_label(map->mem, label);

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

  assert(map->sorted == NULL);

  ref = (cmark_reference *)map->mem->calloc(1, sizeof(*ref));
  ref->entry.label = reflabel;
  ref->url = cmark_clean_url(map->mem, url);
  ref->title = cmark_clean_title(map->mem, title);
  ref->entry.age = map->size;
  ref->entry.next = map->refs;

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

cmark_map *cmark_reference_map_new(cmark_mem *mem) {
  return cmark_map_new(mem, reference_free);
}

Version data entries

43 entries across 43 versions & 5 rubygems

Version Path
qiita_marker-0.23.6.2 ext/qiita_marker/references.c
commonmarker-0.23.7.pre1 ext/commonmarker/references.c
qiita_marker-0.23.6.1 ext/qiita_marker/references.c
qiita_marker-0.23.6.0 ext/qiita_marker/references.c
commonmarker-0.23.6 ext/commonmarker/references.c
qiita_marker-0.23.5.1 ext/qiita_marker/references.c
qiita_marker-0.23.5.0 ext/qiita_marker/references.c
commonmarker-0.23.5 ext/commonmarker/references.c
qiita_marker-0.23.2.3 ext/qiita_marker/references.c
commonmarker-0.23.4 ext/commonmarker/references.c
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/commonmarker-0.23.2/ext/commonmarker/references.c
markly-0.7.0 ext/markly/references.c
qiita_marker-0.23.2.2 ext/qiita_marker/references.c
qiita_marker-0.23.2.1 ext/qiita_marker/references.c
qiita_marker-0.23.2.0 ext/qiita_marker/references.c
commonmarker-0.23.2 ext/commonmarker/references.c
commonmarker-0.23.1 ext/commonmarker/references.c
markly-0.6.1 ext/markly/references.c
commonmarker-0.23.0 ext/commonmarker/references.c
markly-0.6.0 ext/markly/references.c