dbus/config: remove unused method
Null checking is replaced by helper/args while string building is no longer required. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
8492239cba
commit
ee2f5ed6ac
@ -1,10 +1,5 @@
|
||||
package dbus
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
// See set 'see' policy for NAME (--see=NAME)
|
||||
See []string `json:"see"`
|
||||
@ -58,23 +53,6 @@ func (c *Config) Args(bus [2]string) (args []string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Config) buildSeal(seal *strings.Builder, bus [2]string) error {
|
||||
for _, arg := range c.Args(bus) {
|
||||
// reject argument strings containing null
|
||||
for _, b := range arg {
|
||||
if b == '\x00' {
|
||||
return errors.New("argument contains null")
|
||||
}
|
||||
}
|
||||
|
||||
// write null terminated argument
|
||||
seal.WriteString(arg)
|
||||
seal.WriteByte('\x00')
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewConfig returns a reference to a Config struct with optional defaults.
|
||||
// If id is an empty string own defaults are omitted.
|
||||
func NewConfig(id string, defaults, mpris bool) (c *Config) {
|
||||
|
Loading…
Reference in New Issue
Block a user