Use &struct{} instead of new

This commit is contained in:
Charles committed 2015-09-16 22:27:36 +08:00
1 parent cc3f374623
commit 12ea3b8e28
7 files changed
+53 -50

No files matched your search

+8 -8
View File
@@ -15,10 +15,10 @@ type CryptionReader struct {
}
func NewCryptionReader(stream cipher.Stream, reader io.Reader) *CryptionReader {
this := new(CryptionReader)
this.stream = stream
this.reader = reader
return this
return &CryptionReader{
stream: stream,
reader: reader,
}
}
// Read reads blocks from underlying reader, the length of blocks must be
@@ -42,10 +42,10 @@ type CryptionWriter struct {
}
func NewCryptionWriter(stream cipher.Stream, writer io.Writer) *CryptionWriter {
this := new(CryptionWriter)
this.stream = stream
this.writer = writer
return this
return &CryptionWriter{
stream: stream,
writer: writer,
}
}
// Write writes the give blocks to underlying writer. The length of the blocks