void *malloc(size_t) -> int malloc(void **, size_t) - #2080
Conversation
|
So I think that this PR provided a lot of value in terms of: more and better error checking, and some code cleanups. However, that MSVC warns when passing additional levels on indirection to a func that takes a I propose that we take the cleanups but keep the signature as-is. I will push up another PR when I get some time to unfactor (is that a word?) the signature changes. If anybody objects to this strategy, please let me know! |
|
Yes, definitely. Let's merge only the cleanups. :) |
|
While I was making index changes and cleanups in #2108, I incorporated some of the types of changes here, such as more cleanup on error and changing the interface of |
|
@ethomson Have you extracted the pieces of this that you want or shall we keep it open? |
|
Either way we decided this is not a good idea, so feel free to cherry pick what you want from the branch. Closing now! |
This was an exercise in discovering whether we could / should change the allocators to fit more with the standards we use for other things - returning an
intstatus code and taking a pointer that will be set to the allocated memory. I'm pushing this up more for discussion, at the moment, to see if we even want to continue down this path.Note that I did this on win32 so it's pretty likely that Travis won't even build this successfully. Also, I broke blame, so the tests there will fail miserably at the moment.
I think this was very valuable as a learning experience, as it required me to touch every allocation throughout the library. My takeaway is that switching us over to free memory in the event of an allocation failure would generally not be ridiculously burdensome.
Additional takeaways:
*alloc, generally. (Yay!) There were a few that we must have simply overlooked, but there was only one area that was systematically poor,.git_oid__fmtzshould probably exist, at least as an internal helper.However, this didn't provide nearly the value that I had hoped. In fact, I would say that it's an overall negative since there are now more unfun compiler warnings.
Anyway. I did want to push this up for the sake of discussion, but I think that we should abandon this effort and keep
mallocsane. Certainly we should go fix up the problem areas that I noticed, though.