Skip to content

Commit e0cbc13

Browse files
committed
#72 Initialize the permessage, keystrings, readslices, commandset, and anotherset using make()
1 parent 191b274 commit e0cbc13

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lhost/via-postfix.go

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

56-
permessage := map[string]string{} // Store values of each Per-Message field
57-
keystrings := []string{} // Key list of permessage
56+
permessage := make(map[string]string, 4) // Store values of each Per-Message field
57+
keystrings := make([]string, 0, 4) // 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 := map[string]string{} // Another error information
63-
commandset := []string{} // "in reply to * command" list
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
6464
v := &(dscontents[len(dscontents) - 1])
6565

6666
if proceedsto == 2 {
@@ -99,8 +99,8 @@ func init() {
9999
}
100100
} else {
101101
// The message body is a general bounce mail message of Postfix
102-
readcursor := uint8(0) // Points the current cursor position
103-
readslices := []string{""} // Copy each line for later reference
102+
readcursor := uint8(0) // Points the current cursor position
103+
readslices := make([]string, 1, 64) // 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

0 commit comments

Comments
 (0)