LonnyGomes / hexcurse

Hexcurse is a ncurses-based console hexeditor written in C
Other
180 stars 17 forks source link

Use malloc() and free() instead of alloca() #18

Closed fornwall closed 9 years ago

fornwall commented 9 years ago

This allows building with the Android NDK which lacks alloca().

fornwall commented 9 years ago

Sorry - I was too quick!

There is alloca() support in Android, but alloca.h needs to be included. This is now guarded by checking if _SGIAPI is defined - do you want that to include a check for ANDROID as well instead of using malloc/free? I can submit a new pull request in that case.ä!

ghost commented 9 years ago

Thanks for the PR @fornwall, I actually like the idea of checking for ANDROID a bit better as it seems a bit cleaner. Could you do another PR?

ghost commented 9 years ago

I may have been too quick to respond as well. After looking at getopt.c, there really isn't any reason to use alloca over malloc/free so I think this should work on any platform (including SGI if it's still being used there).

Thanks for the contribution!