forked from commonmark/cmark
-
Notifications
You must be signed in to change notification settings - Fork 124
Add type-aware allocator functions to the default allocator #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
QuietMisdreavus
wants to merge
8
commits into
gfm
Choose a base branch
from
vgm/typed-allocators
base: gfm
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cc79540
add typed allocator wrappers to cmark_mem
QuietMisdreavus a34f4a2
add standalone allocator wrapper functions
QuietMisdreavus 02fdc45
replace all cmark_mem uses with indirect function calls
QuietMisdreavus eb0e540
review: the inference attribute isn't necessary on the static functions
QuietMisdreavus 243ea57
add typed allocator shims to the arena allocator
QuietMisdreavus 3c47597
add fallback 'cmark_mem_typed' functions
QuietMisdreavus 29fc4b3
review: rename CMARK_MALLOC to CMARK_CALLOC_ONE
QuietMisdreavus 6ec2ec4
suppress the allocator wrappers warning for the allocator wrappers
QuietMisdreavus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // swift-tools-version:6.3 | ||
| // The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
|
||
| import PackageDescription | ||
|
|
||
| var cSettings: [CSetting] = [ | ||
| .unsafeFlags(["-ftyped-memory-operations"]), | ||
| .enableWarning("allocator-wrappers"), | ||
| ] | ||
|
|
||
| #if os(Windows) | ||
| // When building the library on Windows, we do not have proper control of | ||
| // whether it is being built statically or dynamically. However, given the | ||
| // current default of static, we will assume that we are building | ||
| // statically. More importantly, should this not hold, this will fail at | ||
| // link time. | ||
| cSettings.append( | ||
| .define("CMARK_GFM_STATIC_DEFINE", .when(platforms: [.windows])) | ||
| ) | ||
| #endif | ||
|
|
||
| let package = Package( | ||
| name: "cmark-gfm", | ||
| products: [ | ||
| // Products define the executables and libraries a package produces, and make them visible to other packages. | ||
| .library( | ||
| name: "cmark-gfm", | ||
| targets: ["cmark-gfm"]), | ||
| .library( | ||
| name: "cmark-gfm-extensions", | ||
| targets: ["cmark-gfm-extensions"]), | ||
| .executable( | ||
| name: "cmark-gfm-bin", | ||
| targets: ["cmark-gfm-bin"]), | ||
| .executable(name: "api_test", | ||
| targets: ["api_test"]) | ||
| ], | ||
| targets: [ | ||
| .target(name: "cmark-gfm", | ||
| path: "src", | ||
| exclude: [ | ||
| "scanners.re", | ||
| "libcmark-gfm.pc.in", | ||
| "config.h.in", | ||
| "CMakeLists.txt", | ||
| ], | ||
| cSettings: cSettings | ||
| ), | ||
| .target(name: "cmark-gfm-extensions", | ||
| dependencies: [ | ||
| "cmark-gfm", | ||
| ], | ||
| path: "extensions", | ||
| exclude: [ | ||
| "CMakeLists.txt", | ||
| "ext_scanners.re", | ||
| ], | ||
| cSettings: cSettings | ||
| ), | ||
| .executableTarget(name: "cmark-gfm-bin", | ||
| dependencies: [ | ||
| "cmark-gfm", | ||
| "cmark-gfm-extensions", | ||
| ], | ||
| path: "bin", | ||
| sources: [ | ||
| "main.c", | ||
| ] | ||
| ), | ||
| .executableTarget(name: "api_test", | ||
| dependencies: [ | ||
| "cmark-gfm", | ||
| "cmark-gfm-extensions", | ||
| ], | ||
| path: "api_test", | ||
| exclude: [ | ||
| "CMakeLists.txt", | ||
| ] | ||
| ) | ||
| ] | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than zero initializing, it might be worth considering: