-
Notifications
You must be signed in to change notification settings - Fork 7
Modernise lua-archive #2
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
base: master
Are you sure you want to change the base?
Conversation
@@ -38,8 +38,12 @@ static int ar_version(lua_State *L) { | |||
} | |||
|
|||
////////////////////////////////////////////////////////////////////// | |||
#if !defined LUA_VERSION_NUM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this #if be refactored into a header (perhaps ar.h?) so we can avoid copying it into ar_entry.c?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
From http://lua-users.org/wiki/CompatibilityWithLuaFive: luaL_reg (Lua 5.0) changed its name to luaL_Reg since Lua 5.1. Apply the recommended fix to support lua 5.1 and prior versions.
Use lua_getuservalue()/lua_setuservalue() instead of the removed lua_getfenv()/lua_setfenv().
Replace the deprecated functions with their libarchive 3.0 replacements as listed at: https://github.com/libarchive/libarchive/wiki/ManPageLibarchiveChanges3
"wrote" was checked against -1 but was never actually set.
When running the tests, libarchive says: InvalidFFlag: 'archive' is not a known fflag So remove that one flag from our tests.
Note that I had to disable the "__gc" functions for the code to work and the tests to pass on Lua 5.3. I don't think that the existing code should regress on 5.1 or older, but I'm still investigating the problems with newer Lua versions. |
It at least compiles and loads for me. |
Lua 5.2 and 5.3 support, as well as porting to libarchive 3.0.
Untested.