Skip to content

Commit

Permalink
improve table.unique
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Oct 26, 2023
1 parent 311171b commit ab8ceb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 6 additions & 0 deletions xmake/core/base/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ function table.unique(array, barrier)
table.insert(unique, v)
end
end
if array.__wrap_locked__ then
table.wrap_lock(unique)
end
array = unique
end
end
Expand All @@ -402,6 +405,9 @@ function table.reverse_unique(array, barrier)
table.insert(unique, 1, v)
end
end
if array.__wrap_locked__ then
table.wrap_lock(unique)
end
array = unique
end
end
Expand Down
10 changes: 0 additions & 10 deletions xmake/core/package/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -910,11 +910,6 @@ function _instance:manifest_save()
local name = apiname:sub(13)
local values = self:get(name)
if values ~= nil then
-- we need wrap locked value, e.g. linkgroups = {{"m", "pthread"}}
values = table.wrap(table.clone(values))
for _, value in ipairs(values) do
table.wrap_unlock(value)
end
vars = vars or {}
vars[name] = values
local extra = self:extraconf(name)
Expand All @@ -928,11 +923,6 @@ function _instance:manifest_save()
if comp then
local component_values = comp:get(name)
if component_values ~= nil then
-- we need wrap locked value, e.g. linkgroups = {{"m", "pthread"}}
component_values = table.wrap(table.clone(component_values))
for _, value in ipairs(component_values) do
table.wrap_unlock(value)
end
components = components or {}
components.vars = components.vars or {}
components.vars[component_name] = components.vars[component_name] or {}
Expand Down

0 comments on commit ab8ceb9

Please sign in to comment.