Commit 43456b4a authored by Robert Griesemer's avatar Robert Griesemer

remove superfluous indirection

R=rsc
DELTA=7  (0 added, 0 deleted, 7 changed)
OCL=29776
CL=29778
parent 8083467d
...@@ -24,13 +24,13 @@ type Format datafmt.Format; ...@@ -24,13 +24,13 @@ type Format datafmt.Format;
type state struct { type state struct {
// for now we have very little state // for now we have very little state
// TODO maintain list of unassociated comments // TODO maintain list of unassociated comments
optSemi *bool optSemi bool
} }
func (s *state) Copy() datafmt.Environment { func (s *state) Copy() datafmt.Environment {
optSemi := *s.optSemi; copy := *s;
return &state{&optSemi}; return ©
} }
...@@ -56,19 +56,19 @@ func isMultiLineComment(s *datafmt.State, value interface{}, ruleName string) bo ...@@ -56,19 +56,19 @@ func isMultiLineComment(s *datafmt.State, value interface{}, ruleName string) bo
func clearOptSemi(s *datafmt.State, value interface{}, ruleName string) bool { func clearOptSemi(s *datafmt.State, value interface{}, ruleName string) bool {
*s.Env().(*state).optSemi = false; s.Env().(*state).optSemi = false;
return true; return true;
} }
func setOptSemi(s *datafmt.State, value interface{}, ruleName string) bool { func setOptSemi(s *datafmt.State, value interface{}, ruleName string) bool {
*s.Env().(*state).optSemi = true; s.Env().(*state).optSemi = true;
return true; return true;
} }
func optSemi(s *datafmt.State, value interface{}, ruleName string) bool { func optSemi(s *datafmt.State, value interface{}, ruleName string) bool {
if !*s.Env().(*state).optSemi { if !s.Env().(*state).optSemi {
s.Write([]byte{';'}); s.Write([]byte{';'});
} }
return true; return true;
...@@ -109,7 +109,7 @@ func NewFormat(filename string) (Format, os.Error) { ...@@ -109,7 +109,7 @@ func NewFormat(filename string) (Format, os.Error) {
// of bytes written and an os.Error, if any. // of bytes written and an os.Error, if any.
// //
func (f Format) Fprint(w io.Writer, nodes ...) (int, os.Error) { func (f Format) Fprint(w io.Writer, nodes ...) (int, os.Error) {
s := state{new(bool)}; var s state;
return datafmt.Format(f).Fprint(w, &s, nodes); return datafmt.Format(f).Fprint(w, &s, nodes);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment