Skip to content

Commit 42f0c55

Browse files
committed
#72 Initialize the ipv4a([]string) using make()
1 parent abb91fe commit 42f0c55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rfc791/lib.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func FindIPv4Address(argv1 *string) []string {
3737
argv2 := *argv1
3838
for _, e := range []string{"(", ")", "[", "]", ","} { argv2 = strings.ReplaceAll(argv2, e, " ") }
3939

40-
ipv4a := []string{}; for _, e := range strings.Split(argv2, " ") {
40+
ipv4a := make([]string, 0, 4); for _, e := range strings.Split(argv2, " ") {
4141
// Find a string including an IPv4 address
4242
if strings.IndexByte(e, '.') < 0 { continue } // IPv4 address must include "." character
4343
if IsIPv4Address(e) == false { continue } // The string is an IPv4 address or not

0 commit comments

Comments
 (0)