From: David Symonds Date: Wed, 22 Apr 2009 01:36:53 +0000 (-0700) Subject: Bug 143 is fixed, so clean up some of exvar. X-Git-Tag: weekly.2009-11-06~1779 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f8931c6cebc6a4bae54d0114beb65b336b5cdba8;p=gostls13.git Bug 143 is fixed, so clean up some of exvar. R=r APPROVED=r DELTA=8 (3 added, 1 deleted, 4 changed) OCL=27699 CL=27701 --- diff --git a/src/lib/exvar.go b/src/lib/exvar.go index 38fd2c152b..6b2aaeb7a6 100644 --- a/src/lib/exvar.go +++ b/src/lib/exvar.go @@ -130,8 +130,7 @@ func IncrementInt(name string, inc int) { func IncrementMapInt(name string, key string, inc int) { workSync(func(state *exVars) { mv := state.getOrInitMapVar(name); - // TODO(dsymonds): Change this to just mv[key] when bug143 is fixed. - if v, ok := (*mv)[key]; ok { + if v, ok := mv[key]; ok { mv[key] += inc } else { mv[key] = inc @@ -167,9 +166,12 @@ func GetMapInt(name string, key string) int { var i int; var ok bool; workSync(func(state *exVars) { - // TODO(dsymonds): Change this to just getOrInitMapVar(name)[key] when - // bug143 is fixed. - i, ok = (*state.getOrInitMapVar(name))[key]; + // This doesn't work: + // i, ok = state.getOrInitMapVar(name)[key]; + // exvar.go:169: assignment count mismatch: 2 = 1 + // Should it? Wrapping the method call in () doesn't help. + mv := state.getOrInitMapVar(name); + i, ok = mv[key]; }); return i }