1
0
Fork
You've already forked tinyalloc
0

Correctness fixes and (optional) better C stdlib integration #13

Open
jlindgren90 wants to merge 4 commits from jlindgren90/stdlib-integration into master
pull from: jlindgren90/stdlib-integration
merge into: thi.ng:master
thi.ng:master
jlindgren90 commented 2024年03月23日 20:41:43 +01:00 (Migrated from github.com)
Copy link
  • Add early NULL check to ta_free()
  • Add overflow checks in alloc_block() and ta_calloc()
  • Clear full block size to 0's in ta_calloc()
  • Optionally set errno to ENOMEM when out of memory
  • Optionally use memset() to implement memclear()
  • Add ta_getsize() to return allocated block size
  • Add ta_realloc() (optional, requires memcpy())

ta_getsize() and ta_realloc() are based on ideas from #11, but rewritten to fix various issues in that PR.

- Add early NULL check to ta_free() - Add overflow checks in alloc_block() and ta_calloc() - Clear full block size to 0's in ta_calloc() - Optionally set errno to ENOMEM when out of memory - Optionally use memset() to implement memclear() - Add ta_getsize() to return allocated block size - Add ta_realloc() (optional, requires memcpy()) ta_getsize() and ta_realloc() are based on ideas from #11, but rewritten to fix various issues in that PR.
jlindgren90 commented 2024年03月25日 05:04:27 +01:00 (Migrated from github.com)
Copy link

Updated with some more fixes:

  • Fix behavior of ta_alloc(0) (see #15)
  • Fix additional arithmetic overflows
  • Add fallback memcopy() when not using C stdlib
  • Add early return to ta_realloc() when size is similar
Updated with some more fixes: - Fix behavior of ta_alloc(0) (see #15) - Fix additional arithmetic overflows - Add fallback memcopy() when not using C stdlib - Add early return to ta_realloc() when size is similar
postspectacular commented 2024年03月27日 08:26:14 +01:00 (Migrated from github.com)
Copy link

@jlindgren90 Thank you very much for this and the other PR - I will take a look asap, but likely will take a little while for me to review & test this...

@jlindgren90 Thank you very much for this and the other PR - I will take a look asap, but likely will take a little while for me to review & test this...
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin jlindgren90/stdlib-integration:jlindgren90/stdlib-integration
git switch jlindgren90/stdlib-integration

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff jlindgren90/stdlib-integration
git switch jlindgren90/stdlib-integration
git rebase master
git switch master
git merge --ff-only jlindgren90/stdlib-integration
git switch jlindgren90/stdlib-integration
git rebase master
git switch master
git merge --no-ff jlindgren90/stdlib-integration
git switch master
git merge --squash jlindgren90/stdlib-integration
git switch master
git merge --ff-only jlindgren90/stdlib-integration
git switch master
git merge jlindgren90/stdlib-integration
git push origin master
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
thi.ng/tinyalloc!13
Reference in a new issue
thi.ng/tinyalloc
No description provided.
Delete branch "jlindgren90/stdlib-integration"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?