Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 09:49:09 -0600
From:      Kyle Evans <kevans@freebsd.org>
To:        "Rodney W. Grimes" <rgrimes@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r329854 - head/stand/lua
Message-ID:  <CACNAnaGNMbGvBSgwxibcWCxFo0Xvs8aYW1sb6iLmiT2ZwwJPtw@mail.gmail.com>
In-Reply-To: <201802231449.w1NEnEf0096157@pdx.rh.CN85.dnsmgr.net>
References:  <201802230318.w1N3IOmX028961@repo.freebsd.org> <201802231449.w1NEnEf0096157@pdx.rh.CN85.dnsmgr.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 23, 2018 at 8:49 AM, Rodney W. Grimes
<freebsd@pdx.rh.cn85.dnsmgr.net> wrote:
> [ Charset UTF-8 unsupported, converting... ]
>> Author: kevans
>> Date: Fri Feb 23 03:18:24 2018
>> New Revision: 329854
>> URL: https://svnweb.freebsd.org/changeset/base/329854
>>
>> Log:
>>   lualoader: shallowCopyTable => deepCopyTable
>>
>>   I called it a shallow copy, but it wasn't really a shallow copy at all.
>
> Isnt it really neither shallow nor deep, but just CopyTable?
>

I would think (and expect) that CopyTable wouldn't recursively copy
any table values in the table as this version does, opting to
eliminate that entirely and just copying all values as-is.

>> Modified:
>>   head/stand/lua/core.lua
>>   head/stand/lua/menu.lua
>>
>> Modified: head/stand/lua/core.lua
>> ==============================================================================
>> --- head/stand/lua/core.lua   Fri Feb 23 03:11:43 2018        (r329853)
>> +++ head/stand/lua/core.lua   Fri Feb 23 03:18:24 2018        (r329854)
>> @@ -286,11 +286,11 @@ function core.isSystem386()
>>  end
>>
>>  -- This may be a better candidate for a 'utility' module.
>> -function core.shallowCopyTable(tbl)
>> +function core.deepCopyTable(tbl)
>>       local new_tbl = {}
>>       for k, v in pairs(tbl) do
>>               if type(v) == "table" then
>> -                     new_tbl[k] = core.shallowCopyTable(v)
>> +                     new_tbl[k] = core.deepCopyTable(v)
>>               else
>>                       new_tbl[k] = v
>>               end
>>
>> Modified: head/stand/lua/menu.lua
>> ==============================================================================
>> --- head/stand/lua/menu.lua   Fri Feb 23 03:11:43 2018        (r329853)
>> +++ head/stand/lua/menu.lua   Fri Feb 23 03:18:24 2018        (r329854)
>> @@ -222,7 +222,7 @@ menu.welcome = {
>>                               return menu.welcome.swapped_menu
>>                       end
>>                       -- Shallow copy the table
>> -                     menu_entries = core.shallowCopyTable(menu_entries)
>> +                     menu_entries = core.deepCopyTable(menu_entries)
>>
>>                       -- Swap the first two menu entries
>>                       menu_entries[1], menu_entries[2] =
>>
>>
>
> --
> Rod Grimes                                                 rgrimes@freebsd.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaGNMbGvBSgwxibcWCxFo0Xvs8aYW1sb6iLmiT2ZwwJPtw>