Skip to content

Commit 9a9edb9

Browse files
fperradhishamhm
authored andcommitted
refactor coxpcall dependency (#41)
* alter global pcall & xpcall instead of their local copies like ringer.lua & xavante.lua * remove duplicated coxpcall stuff all is already done in wsapi.common see https://github.com/keplerproject/wsapi/blob/master/src/wsapi/common.lua#L21-L25 `coxpcall` (like `rings`) are not longer a direct dependencies of `wsapi-fcgi` & `wsapi-xavante`. So, the `rockspec` could be updated like this: ```diff wsapi: -dependencies = { "luafilesystem >= 1.6.2" } +dependencies = { "luafilesystem >= 1.6.2", "rings >= 1.3.0", "coxpcall >= 1.14" } wsapi-fcgi: -dependencies = { "wsapi >= 1.6.1", "rings >= 1.3.0", "coxpcall >= 1.14" } +dependencies = { "wsapi >= 1.6.x" } wsapi-xavante: -dependencies = { "wsapi >= 1.6.1", "rings >= 1.3.0", "coxpcall >= 1.14", "xavante >= 2.3.0" } +dependencies = { "wsapi >= 1.6.x", "xavante >= 2.3.0" } ``` * coxpcall is useless with LuaJIT use same logic as in copas see https://github.com/keplerproject/copas/blob/master/src/copas.lua#L28-L30 * update history/changelog
1 parent 3b5fe7a commit 9a9edb9

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

doc/us/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ <h2>Latest Sources and Bug Tracker</h2>
131131

132132
<h2>History</h2>
133133

134+
<p><strong>WSAPI</strong> [unreleased]</p>
135+
136+
<ul>
137+
<li>Refactor coxpcall dependency (Francois Perrad)</li>
138+
</ul>
139+
134140
<p><strong>WSAPI 1.6.1</strong> [21/Mar/2014]</p>
135141

136142
<ul>

src/wsapi/common.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ local debug = require "debug"
1515
local wsapi = require "wsapi"
1616
local lfs = require "lfs"
1717

18-
local tostring, tonumber, pairs, ipairs, error, type, pcall, xpcall, setmetatable, dofile, rawget, rawset, assert, loadfile =
19-
tostring, tonumber, pairs, ipairs, error, type, pcall, xpcall, setmetatable, dofile, rawget, rawset, assert, loadfile
20-
21-
if _VERSION < "Lua 5.2" then
18+
if _VERSION=="Lua 5.1" and not jit then -- obsolete: only for Lua 5.1 compatibility
2219
local coxpcall = require "coxpcall"
2320
pcall = coxpcall.pcall
2421
xpcall = coxpcall.xpcall
2522
end
2623

24+
local tostring, tonumber, pairs, ipairs, error, type, pcall, xpcall, setmetatable, dofile, rawget, rawset, assert, loadfile =
25+
tostring, tonumber, pairs, ipairs, error, type, pcall, xpcall, setmetatable, dofile, rawget, rawset, assert, loadfile
26+
2727
local package = package
2828

2929
local _, ringer = pcall(require, "wsapi.ringer")

src/wsapi/ringer.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ local init = [==[
2424
_, package.cpath = remotedostring("return package.cpath")
2525
end
2626
local common = require"wsapi.common"
27-
local coxpcall = require "coxpcall"
28-
pcall = coxpcall.pcall
29-
xpcall = coxpcall.xpcall
3027
3128
local wsapi_error = {
3229
write = function (self, err)

src/wsapi/xavante.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
--
77
-----------------------------------------------------------------------------
88

9-
local coxpcall = require "coxpcall"
10-
11-
pcall = coxpcall.pcall
12-
xpcall = coxpcall.xpcall
13-
149
local common = require"wsapi.common"
1510

1611
local _M = {}

0 commit comments

Comments
 (0)