Browse Source

isupport List.Tokens map[string]*string -> map[string]string

tags/v2.2.0-rc1
jesopo 4 years ago
parent
commit
5fbf9c650e
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      irc/isupport/list.go

+ 8
- 8
irc/isupport/list.go View File

15
 
15
 
16
 // List holds a list of ISUPPORT tokens
16
 // List holds a list of ISUPPORT tokens
17
 type List struct {
17
 type List struct {
18
-	Tokens      map[string]*string
18
+	Tokens      map[string]string
19
 	CachedReply [][]string
19
 	CachedReply [][]string
20
 }
20
 }
21
 
21
 
27
 }
27
 }
28
 
28
 
29
 func (il *List) Initialize() {
29
 func (il *List) Initialize() {
30
-	il.Tokens = make(map[string]*string)
30
+	il.Tokens = make(map[string]string)
31
 	il.CachedReply = make([][]string, 0)
31
 	il.CachedReply = make([][]string, 0)
32
 }
32
 }
33
 
33
 
34
 // Add adds an RPL_ISUPPORT token to our internal list
34
 // Add adds an RPL_ISUPPORT token to our internal list
35
 func (il *List) Add(name string, value string) {
35
 func (il *List) Add(name string, value string) {
36
-	il.Tokens[name] = &value
36
+	il.Tokens[name] = value
37
 }
37
 }
38
 
38
 
39
 // AddNoValue adds an RPL_ISUPPORT token that does not have a value
39
 // AddNoValue adds an RPL_ISUPPORT token that does not have a value
40
 func (il *List) AddNoValue(name string) {
40
 func (il *List) AddNoValue(name string) {
41
-	il.Tokens[name] = nil
41
+	il.Tokens[name] = ""
42
 }
42
 }
43
 
43
 
44
 // getTokenString gets the appropriate string for a token+value.
44
 // getTokenString gets the appropriate string for a token+value.
45
-func getTokenString(name string, value *string) string {
46
-	if value == nil || len(*value) == 0 {
45
+func getTokenString(name string, value string) string {
46
+	if len(value) == 0 {
47
 		return name
47
 		return name
48
 	}
48
 	}
49
 
49
 
50
-	return fmt.Sprintf("%s=%s", name, *value)
50
+	return fmt.Sprintf("%s=%s", name, value)
51
 }
51
 }
52
 
52
 
53
 // GetDifference returns the difference between two token lists.
53
 // GetDifference returns the difference between two token lists.
69
 	// append added tokens
69
 	// append added tokens
70
 	for name, value := range newil.Tokens {
70
 	for name, value := range newil.Tokens {
71
 		newval, exists := il.Tokens[name]
71
 		newval, exists := il.Tokens[name]
72
-		if exists && ((value == nil && newval == nil) || (value != nil && newval != nil && *value == *newval)) {
72
+		if exists && value == newval {
73
 			continue
73
 			continue
74
 		}
74
 		}
75
 
75
 

Loading…
Cancel
Save