summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-28 07:36:13 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-28 07:36:13 +0900
commit1e360ff7f5afca5bdaab04acd3a5ce8398cd5003 (patch)
tree1adec571be61a83d7746385424177c7fafa62029 /tools
parent70434c96d21adef5b71041297009e60e89c91b45 (diff)
config: fix misuse of pointers
Equal method for map misuses a pointer; all the entry of the map becomes idential. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'tools')
-rw-r--r--tools/pyang_plugins/bgpyang2golang.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/pyang_plugins/bgpyang2golang.py b/tools/pyang_plugins/bgpyang2golang.py
index ebe1de8d..5c3819a7 100644
--- a/tools/pyang_plugins/bgpyang2golang.py
+++ b/tools/pyang_plugins/bgpyang2golang.py
@@ -309,8 +309,8 @@ def emit_class_def(ctx, yang_statement, struct_name, prefix):
print >> o, '}'
print >> o, '{'
print >> o, 'lmap := make(map[string]*{0})'.format(type_name[2:])
- print >> o, 'for _, l := range lhs.{0} {{'.format(val_name)
- print >> o, 'lmap[string({0})] = &l'.format(' + '.join('l.{0}'.format(convert_to_golang(v)) for v in elem.split(' ')))
+ print >> o, 'for i, l := range lhs.{0} {{'.format(val_name)
+ print >> o, 'lmap[string({0})] = &lhs.{1}[i]'.format(' + '.join('l.{0}'.format(convert_to_golang(v)) for v in elem.split(' ')), val_name)
print >> o, '}'
print >> o, 'for _, r := range rhs.{0} {{'.format(val_name)
print >> o, 'if l, y := lmap[string({0})]; !y {{'.format('+'.join('r.{0}'.format(convert_to_golang(v)) for v in elem.split(' ')))