From 8478358d77dd86deb4e45ef4805642f1e7a7b9c0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 24 Jul 2023 11:10:54 -0700 Subject: [PATCH] net/art: use "index", not "idx" in function names Updates #7781 Signed-off-by: David Anderson --- net/art/stride_table.go | 10 +++------- net/art/table.go | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/net/art/stride_table.go b/net/art/stride_table.go index fad89a8d6..5d5ae5c9e 100644 --- a/net/art/stride_table.go +++ b/net/art/stride_table.go @@ -85,16 +85,12 @@ func (t *strideTable[T]) deleteChild(idx int) { // setChild replaces the child strideTable for addr (if any) with child. func (t *strideTable[T]) setChild(addr uint8, child *strideTable[T]) { - idx := hostIndex(addr) - if t.entries[idx].child == nil { - t.childRefs++ - } - t.entries[idx].child = child + t.setChildByIndex(hostIndex(addr), child) } -// setChildByIdx replaces the child strideTable at idx (if any) with +// setChildByIndex replaces the child strideTable at idx (if any) with // child. idx should be obtained via a call to getChild. -func (t *strideTable[T]) setChildByIdx(idx int, child *strideTable[T]) { +func (t *strideTable[T]) setChildByIndex(idx int, child *strideTable[T]) { if t.entries[idx].child == nil { t.childRefs++ } diff --git a/net/art/table.go b/net/art/table.go index 59c158fb2..380ae2376 100644 --- a/net/art/table.go +++ b/net/art/table.go @@ -468,7 +468,7 @@ func (t *Table[T]) Delete(pfx netip.Prefix) { if debugDelete { fmt.Printf("delete: compact parent.prefix=%s st.prefix=%s child.prefix=%s\n", parent.prefix, cur.prefix, child.prefix) } - strideTables[strideIdx-1].setChildByIdx(strideIndexes[strideIdx-1], child) + strideTables[strideIdx-1].setChildByIndex(strideIndexes[strideIdx-1], child) return default: // This table has two or more children, so it's acting as a "fork in