bug fix #3416 add wrapper around []= to account for

changes in StringTableRef disabling inc of counter
This commit is contained in:
JamesP 2015-10-05 15:16:43 +10:00
commit 87a6268d3c

View file

@ -135,14 +135,17 @@ proc enlarge(t: StringTableRef) =
if not isNil(t.data[i].key): rawInsert(t, n, t.data[i].key, t.data[i].val) if not isNil(t.data[i].key): rawInsert(t, n, t.data[i].key, t.data[i].val)
swap(t.data, n) swap(t.data, n)
proc `[]=`*(t: StringTableRef, key, val: string) {.rtl, extern: "nstPut".} = proc addVal(t: StringTableRef, key, val: string) =
## puts a (key, value)-pair into `t`.
var index = rawGet(t, key) var index = rawGet(t, key)
if index >= 0: if index >= 0:
t.data[index].val = val t.data[index].val = val
else: else:
if mustRehash(len(t.data), t.counter): enlarge(t) if mustRehash(len(t.data), t.counter): enlarge(t)
rawInsert(t, t.data, key, val) rawInsert(t, t.data, key, val)
proc `[]=`*(t: StringTableRef, key, val: string) {.rtl, extern: "nstPut".} =
## puts a (key, value)-pair into `t`.
t.addVal(key, val)
inc(t.counter) inc(t.counter)
proc raiseFormatException(s: string) = proc raiseFormatException(s: string) =