mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-02 12:08:01 +02:00
common-utils: remove the simple serializer functions that were used for state files
This commit is contained in:
parent
38b6eec456
commit
7fa16292c3
1 changed files with 0 additions and 33 deletions
|
|
@ -99,39 +99,6 @@ function cutils.evaluateRulesApplyProperties (properties, name)
|
|||
end
|
||||
end
|
||||
|
||||
-- simple serializer {"foo", "bar"} -> "foo;bar;"
|
||||
function cutils.serializeArray (a)
|
||||
local str = ""
|
||||
for _, v in ipairs (a) do
|
||||
str = str .. tostring (v):gsub (";", "\\;") .. ";"
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
-- simple deserializer "foo;bar;" -> {"foo", "bar"}
|
||||
function cutils.parseArray (str, convert_value, with_type)
|
||||
local array = {}
|
||||
local val = ""
|
||||
local escaped = false
|
||||
for i = 1, #str do
|
||||
local c = str:sub (i, i)
|
||||
if c == '\\' then
|
||||
escaped = true
|
||||
elseif c == ';' and not escaped then
|
||||
val = convert_value and convert_value (val) or val
|
||||
table.insert (array, val)
|
||||
val = ""
|
||||
else
|
||||
val = val .. tostring (c)
|
||||
escaped = false
|
||||
end
|
||||
end
|
||||
if with_type then
|
||||
array ["pod_type"] = "Array"
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
function cutils.arrayContains (a, value)
|
||||
for _, v in ipairs (a) do
|
||||
if v == value then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue