-
Notifications
You must be signed in to change notification settings - Fork 206
allocation functions: pass size to XREALLOC and XFREE #192
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
Conversation
phew ... I like the idea, but I also had cases in the past where it was useful that those macros don't have arguments... on the other hand, in that case one could still modify those parts... TBH what I don't like is that |
I just used the GMP convention. I think it also makes more sense. realloc and free are aligned. First mem, then size and realloc gets one additional size argument. |
What use case was that? I wonder what you could do that you cannot if this patch is applied. As a datapoint, I have to patch tommath in my project right now since I need those sizes due to the primitive bump allocator I am using. In particular realloc makes problems since there I need the old size to compare and to perform the memcpy. |
memory-leak checking on an embedded device... but that doesn't matter anymore :-) the more important question is now regarding the order of the 2 size arguments to |
Why would that leak checking not work with the new macros? But if it does not matter it does not matter. No need to discuss. Concerning the order - I have three arguments in favour of the order (mem, old, new):
And one against:
But in the end I don't really care and I would like to avoid bikeshed discussions :) |
Okay, accepted :) can you please rebase |
done |
c690ba6
to
66ec9b1
Compare
@sjaeckel rebased again |
This is similar to the signatures of the custom allocation functions provided by GMP. The allocation sizes are useful if the allocator has no easy way to access the allocation size.
@sjaeckel merge conflicts solved and rebased |
zomg I couldn't merge even if I would, which I don't. |
oh, I wasn't fast enough to hit 'Comment' |
Unfortunately my "just merge if clean merging is possible comment" didn't apply here ;) |
This is similar to the signatures of the custom allocation functions provided by GMP.
The allocation sizes are useful if the allocator has no easy way to access the allocation size.