Skip to content
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

Replace SmallStackSafeStackAlloc and AutoFreePtr #7512

Merged
merged 2 commits into from Apr 15, 2019

Conversation

Projects
None yet
3 participants
@michicc
Copy link
Member

commented Apr 14, 2019

Some more cleanup of home-grown standard functions.

michicc added some commits Apr 14, 2019

Codechange: Replace SmallStackSafeStackAlloc with std::array.
The only port that ever used it to make heap allocations instead of stack ones was the NDS port, which got thrown out some time ago.
@PeterN

This comment has been minimized.

Copy link
Member

commented Apr 15, 2019

Change to std::array now, deal with individual std:: vector cases later? Or is that change for change's sake?

@michicc

This comment has been minimized.

Copy link
Member Author

commented Apr 15, 2019

The only change where std::vector would remotely make sense is the singular use of AutoFreePtr, but an uninitialized chunk of memory is fine there.

Everything else is a simple, static buffer for saveload. A plain old C array would do the trick, but std::array has the option that it might not use the stack on system which are limited (I don't know of any, but except for a few more source code characters, I don't see any disadvantage from using it anyway).

@LordAro LordAro merged commit 3872929 into OpenTTD:master Apr 15, 2019

@michicc michicc deleted the michicc:pr/c++11_mem branch Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.