Use pointers to make generic functions work

This commit is contained in:
2024-10-20 12:20:25 +02:00
parent 8a00759c4b
commit c0f5306715
6 changed files with 43 additions and 45 deletions

View File

@@ -19,13 +19,13 @@ func newCommonAttributes() *CommonAttributes {
// AddAttribute adds the attribute to the CommonAttributes.
func (c *CommonAttributes) AddAttribute(name, value string) {
addToSlice(c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value})
addToSlice(&c.UndefinedAttributes, &xml.Attr{Name: xml.Name{Local: name}, Value: value})
}
// DeleteAttribute deletes the attribute from the CommonAttributes. It return an
// error.
func (c *CommonAttributes) DeleteAttribute(id int) error {
if err := deleteFromSlice(c.UndefinedAttributes, id); err != nil {
if err := deleteFromSlice(&c.UndefinedAttributes, id); err != nil {
return fmt.Errorf("error deleting undefined attribute %v from common attributes %v: %v", id, c, err)
}
return nil