diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-11 19:21:55 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-11 19:21:55 +0900 |
| commit | 330a344845aa8653772a9be6c085f4fdb602a028 (patch) | |
| tree | 7ed7f60ad70121be51289cbe9043c003d1940e19 /hst/dbus.go | |
| parent | 48cdf8bf852234ea3dad8dad3d571bb1d9546c32 (diff) | |
hst: improve doc comments
These now read a lot better both in source and on pkgsite.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/dbus.go')
| -rw-r--r-- | hst/dbus.go | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/hst/dbus.go b/hst/dbus.go index 6dd1a2c3..5c4620cc 100644 --- a/hst/dbus.go +++ b/hst/dbus.go @@ -5,8 +5,26 @@ import ( "strings" ) -// BadInterfaceError is returned when Interface fails an undocumented check in xdg-dbus-proxy, -// which would have cause a silent failure. +// BadInterfaceError is returned when Interface fails an undocumented check in +// xdg-dbus-proxy, which would have cause a silent failure. +// +// xdg-dbus-proxy fails without output when this condition is not met: +// +// char *dot = strrchr (filter->interface, '.'); +// if (dot != NULL) +// { +// *dot = 0; +// if (strcmp (dot + 1, "*") != 0) +// filter->member = g_strdup (dot + 1); +// } +// +// trim ".*" since they are removed before searching for '.': +// +// if (g_str_has_suffix (name, ".*")) +// { +// name[strlen (name) - 2] = 0; +// wildcard = TRUE; +// } type BadInterfaceError struct { // Interface is the offending interface string. Interface string @@ -19,7 +37,8 @@ func (e *BadInterfaceError) Error() string { if e == nil { return "<nil>" } - return "bad interface string " + strconv.Quote(e.Interface) + " in " + e.Segment + " bus configuration" + return "bad interface string " + strconv.Quote(e.Interface) + + " in " + e.Segment + " bus configuration" } // BusConfig configures the xdg-dbus-proxy process. @@ -76,31 +95,14 @@ func (c *BusConfig) Interfaces(yield func(string) bool) { } } -// CheckInterfaces checks for invalid interface strings based on an undocumented check in xdg-dbus-error, -// returning [BadInterfaceError] if one is encountered. +// CheckInterfaces checks for invalid interface strings based on an undocumented +// check in xdg-dbus-error, returning [BadInterfaceError] if one is encountered. func (c *BusConfig) CheckInterfaces(segment string) error { if c == nil { return nil } for iface := range c.Interfaces { - /* - xdg-dbus-proxy fails without output when this condition is not met: - char *dot = strrchr (filter->interface, '.'); - if (dot != NULL) - { - *dot = 0; - if (strcmp (dot + 1, "*") != 0) - filter->member = g_strdup (dot + 1); - } - - trim ".*" since they are removed before searching for '.': - if (g_str_has_suffix (name, ".*")) - { - name[strlen (name) - 2] = 0; - wildcard = TRUE; - } - */ if strings.IndexByte(strings.TrimSuffix(iface, ".*"), '.') == -1 { return &BadInterfaceError{iface, segment} } |
