mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-27 00:40:17 +00:00
m1n1.utils: RegMap: Fix aliasing...
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
692817f382
commit
b6823890db
1 changed files with 11 additions and 0 deletions
|
@ -430,6 +430,13 @@ class RangeMap(Reloadable):
|
||||||
self.__end = []
|
self.__end = []
|
||||||
self.__value = []
|
self.__value = []
|
||||||
|
|
||||||
|
def clone(self):
|
||||||
|
r = type(self)()
|
||||||
|
r.__start = list(self.__start)
|
||||||
|
r.__end = list(self.__end)
|
||||||
|
r.__value = [copy.copy(i) for i in self.__value]
|
||||||
|
return r
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.__start)
|
return len(self.__start)
|
||||||
|
|
||||||
|
@ -766,6 +773,10 @@ class RegMapMeta(ReloadableMeta):
|
||||||
m._addrmap = {}
|
m._addrmap = {}
|
||||||
m._rngmap = SetRangeMap()
|
m._rngmap = SetRangeMap()
|
||||||
m._namemap = {}
|
m._namemap = {}
|
||||||
|
else:
|
||||||
|
m._addrmap = dict(m._addrmap)
|
||||||
|
m._rngmap = m._rngmap.clone()
|
||||||
|
m._namemap = dict(m._namemap)
|
||||||
|
|
||||||
for k, v in dct.items():
|
for k, v in dct.items():
|
||||||
if k.startswith("_") or not isinstance(v, tuple):
|
if k.startswith("_") or not isinstance(v, tuple):
|
||||||
|
|
Loading…
Reference in a new issue