diff --git a/vendor/cmark/cmark.odin b/vendor/cmark/cmark.odin index a3f7828be..ac24f620d 100644 --- a/vendor/cmark/cmark.odin +++ b/vendor/cmark/cmark.odin @@ -8,7 +8,6 @@ package cmark import "core:c" import "core:c/libc" -import "core:runtime" BINDING_VERSION :: Version_Info{major = 0, minor = 30, patch = 2} @@ -16,6 +15,10 @@ when ODIN_OS == .Windows { foreign import lib { "cmark_static.lib", } +} else when ODIN_OS == .Linux { + foreign import lib { + "libcmark.a", + } } Option :: enum c.int { @@ -125,20 +128,6 @@ foreign lib { get_default_mem_allocator :: proc() -> (mem: ^Allocator) --- } -// You can use the current context.allocator to make a custom allocator for CMark. -// WARNING: It needs to remain the context.allocator for any subsequent calls into this package. -// -// To use: -// alloc := get_default_allocator() -// alloc^ = make_allocator() -make_allocator :: proc() -> (res: Allocator) { - return Allocator{ - calloc = _calloc, - realloc = _realloc, - free = _free, - } -} - bufsize_t :: distinct i32 // Node creation, destruction, and tree traversal @@ -489,24 +478,4 @@ free_cstring :: proc "c" (str: cstring) { free_string :: proc "c" (s: string) { free_rawptr(raw_data(s)) } -free :: proc{free_rawptr, free_cstring} - -@(private) -_calloc :: proc "c" (num: c.size_t, size: c.size_t) -> (alloc: rawptr) { - context = runtime.default_context() - data, _ := runtime.mem_alloc(int(num * size), 2 * align_of(rawptr), context.allocator, {}) - return raw_data(data) -} - -@(private) -_realloc :: proc "c" (ptr: rawptr, new_size: c.size_t) -> (alloc: rawptr) { - context = runtime.default_context() - data, _ := runtime.mem_resize(ptr, {}, int(new_size), 2 * align_of(rawptr), context.allocator, {}) - return raw_data(data) -} - -@(private) -_free :: proc "c" (ptr: rawptr) { - context = runtime.default_context() - runtime.mem_free(ptr, context.allocator, {}) -} \ No newline at end of file +free :: proc{free_rawptr, free_cstring} \ No newline at end of file diff --git a/vendor/cmark/doc.odin b/vendor/cmark/doc.odin index 350bba04c..d33a0aeb3 100644 --- a/vendor/cmark/doc.odin +++ b/vendor/cmark/doc.odin @@ -114,16 +114,4 @@ package cmark Nodes must only be modified after an `.Exit` event, or an `.Enter` event for leaf nodes. - - Wrapping the context.allocator for CMark's use: - - ```odin - using cm - - alloc := cm.get_default_mem_allocator() - alloc^ = cm.make_allocator() - - ... proceed as usual, but keep in mind that `context.allocator` can't change - for any of the calls to this package. - ``` */ \ No newline at end of file diff --git a/vendor/cmark/linux/libcmark.a b/vendor/cmark/linux/libcmark.a new file mode 100644 index 000000000..28214be07 Binary files /dev/null and b/vendor/cmark/linux/libcmark.a differ