Skip to content

Commit 1de3ec1

Browse files
committed
Use make() only for readslices([]string) #72
1 parent 12b25e0 commit 1de3ec1

6 files changed

+21
-21
lines changed

lhost/via-domino.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ func init() {
5252
},
5353
}
5454

55-
permessage := make(map[string]string, 4) // Store values of each Per-Message field
56-
keystrings := make([]string, 0, 4) // Key list of permessage
55+
permessage := map[string]string{} // Store values of each Per-Message field
56+
keystrings := []string{} // Key list of permessage
5757
dscontents := []sis.DeliveryMatter{{}}
5858
emailparts := rfc5322.Part(&bf.Payload, boundaries, false)
5959
readcursor := uint8(0) // Points the current cursor position

lhost/via-exchange2003.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ func init() {
9494
connvalues := 0 // Counter, 3 if it has got the all values of connheader
9595
connheader := [3]string{"", "", ""} // [To:, Subject:, Date:]
9696
rightindex := uint8(0) // The last index number of dscontents
97-
anotherone := make([]string, 1, 2) // Keeping another error messages
98-
msexchange := make([]bool, 1, 2) // Flag, true if "MSEXCH:" text has been appeared
97+
anotherone := []string{""} // Keeping another error messages
98+
msexchange := []bool{false} // Flag, true if "MSEXCH:" text has been appeared
9999
v := &(dscontents[len(dscontents) - 1])
100100

101101
for _, e := range(strings.Split(emailparts[0], "\n")) {

lhost/via-exim.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func init() {
185185
readcursor := uint8(0) // Points the current cursor position
186186
nextcursor := uint8(0)
187187
recipients := 0 // The number of 'Final-Recipient' header
188-
anotherone := make([]string, 1, 2) // Keeping another error messages
188+
anotherone := []string{""} // Keeping another error messages
189189
rightindex := uint8(0) // The last index number of dscontents
190190
boundary00 := "" // Boundary sting
191191
v := &(dscontents[len(dscontents) - 1])

lhost/via-postfix.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ func init() {
5353
},
5454
}
5555

56-
permessage := make(map[string]string, 4) // Store values of each Per-Message field
57-
keystrings := make([]string, 0, 4) // Key list of permessage
56+
permessage := map[string]string{} // Store values of each Per-Message field
57+
keystrings := []string{} // Key list of permessage
5858
dscontents := []sis.DeliveryMatter{{}}
5959
emailparts := rfc5322.Part(&bf.Payload, boundaries, false)
60-
recipients := uint8(0) // The number of 'Final-Recipient' header
61-
nomessages := false // Delivery report unavailable
62-
anotherset := make(map[string]string, 4) // Another error information
63-
commandset := make([]string, 0, 2) // "in reply to * command" list
60+
recipients := uint8(0) // The number of 'Final-Recipient' header
61+
nomessages := false // Delivery report unavailable
62+
anotherset := map[string]string{} // Another error information
63+
commandset := []string{} // "in reply to * command" list
6464
v := &(dscontents[len(dscontents) - 1])
6565

6666
if proceedsto == 2 {
@@ -100,7 +100,7 @@ func init() {
100100
} else {
101101
// The message body is a general bounce mail message of Postfix
102102
readcursor := uint8(0) // Points the current cursor position
103-
readslices := make([]string, 1, 64) // Copy each line for later reference
103+
readslices := make([]string, 1, 32) // Copy each line for later reference
104104

105105
for j, e := range(strings.Split(emailparts[0], "\n")) {
106106
// Read error messages and delivery status lines from the head of the email to the

lhost/via-qmail.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ func init() {
163163

164164
dscontents := []sis.DeliveryMatter{{}}
165165
emailparts := rfc5322.Part(&bf.Payload, boundaries, false)
166-
anotherone := make([]string, 1, 2) // Keeping another error messages
167-
rightindex := uint8(0) // The last index number of dscontents
168-
readcursor := uint8(0) // Points the current cursor position
169-
recipients := uint8(0) // The number of 'Final-Recipient' header
166+
anotherone := []string{""} // Keeping another error messages
167+
rightindex := uint8(0) // The last index number of dscontents
168+
readcursor := uint8(0) // Points the current cursor position
169+
recipients := uint8(0) // The number of 'Final-Recipient' header
170170
v := &(dscontents[len(dscontents) - 1])
171171

172172
for _, e := range(strings.Split(emailparts[0], "\n")) {

lhost/via-sendmail.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ func init() {
4848
"message": []string{" ----- Transcript of session follows -----"},
4949
"error": []string{"... while talking to "},
5050
}
51-
permessage := make(map[string]string, 4) // Store values of each Per-Message field
52-
keystrings := make([]string, 0, 4) // Key list of permessage
51+
permessage := map[string]string{} // Store values of each Per-Message field
52+
keystrings := []string{} // Key list of permessage
5353
dscontents := []sis.DeliveryMatter{{}}
5454
emailparts := rfc5322.Part(&bf.Payload, boundaries, false)
5555
readcursor := uint8(0) // Points the current cursor position
56-
readslices := make([]string, 0, 64) // Copy each line for later reference
56+
readslices := make([]string, 1, 32) // Copy each line for later reference
5757
recipients := uint8(0) // The number of 'Final-Recipient' header
5858
thecommand := "" // An SMTP command name begins with the string ">>>"
59-
esmtpreply := make([]string, 0, 4) // Reply messages from the remote server on an SMTP session
59+
esmtpreply := []string{} // Reply messages from the remote server on an SMTP session
6060
sessionerr := false // Flag, true if it is an SMTP session error
61-
anotherset := make(map[string]string, 4) // Another error information
61+
anotherset := map[string]string{} // Another error information
6262
v := &(dscontents[len(dscontents) - 1])
6363

6464
for j, e := range(strings.Split(emailparts[0], "\n")) {

0 commit comments

Comments
 (0)