From 03c24c51224e85eb96527a512f5f0483464fc810 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Mon, 16 Sep 2024 20:32:07 +0900 Subject: move acl and xcb binding packages to top level These packages are reasonably clean and do not interact with other packages. Signed-off-by: Ophestra Umiker --- internal/xcb/export.go | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 internal/xcb/export.go (limited to 'internal/xcb/export.go') diff --git a/internal/xcb/export.go b/internal/xcb/export.go deleted file mode 100644 index 72a74131..00000000 --- a/internal/xcb/export.go +++ /dev/null @@ -1,47 +0,0 @@ -package xcb - -//#include -//#include -//#cgo linux LDFLAGS: -lxcb -import "C" -import ( - "errors" - "unsafe" -) - -const ( - HostModeInsert = C.XCB_HOST_MODE_INSERT - HostModeDelete = C.XCB_HOST_MODE_DELETE - - FamilyInternet = C.XCB_FAMILY_INTERNET - FamilyDecnet = C.XCB_FAMILY_DECNET - FamilyChaos = C.XCB_FAMILY_CHAOS - FamilyServerInterpreted = C.XCB_FAMILY_SERVER_INTERPRETED - FamilyInternet6 = C.XCB_FAMILY_INTERNET_6 -) - -func ChangeHosts(mode, family C.uint8_t, address string) error { - var c *C.xcb_connection_t - c = C.xcb_connect(nil, nil) - defer C.xcb_disconnect(c) - - if err := xcbHandleConnectionError(c); err != nil { - return err - } - - addr := C.CString(address) - cookie := C.xcb_change_hosts_checked(c, mode, family, C.ushort(len(address)), (*C.uchar)(unsafe.Pointer(addr))) - C.free(unsafe.Pointer(addr)) - - if err := xcbHandleConnectionError(c); err != nil { - return err - } - - e := C.xcb_request_check(c, cookie) - if e != nil { - defer C.free(unsafe.Pointer(e)) - return errors.New("xcb_change_hosts() failed") - } - - return nil -} -- cgit v1.3.1