From 056042ca925e318b335e8b970e98df1fac739291 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 15 Nov 2022 02:38:38 +0900 Subject: [PATCH] internal/graphicsdriver/opengl/gl: refactoring --- internal/graphicsdriver/opengl/gl/procaddr_darwin.go | 5 +---- internal/graphicsdriver/opengl/gl/procaddr_others.go | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/graphicsdriver/opengl/gl/procaddr_darwin.go b/internal/graphicsdriver/opengl/gl/procaddr_darwin.go index 4bed949c4..ada2dbd48 100644 --- a/internal/graphicsdriver/opengl/gl/procaddr_darwin.go +++ b/internal/graphicsdriver/opengl/gl/procaddr_darwin.go @@ -40,10 +40,7 @@ func (c *defaultContext) init() error { func (c *defaultContext) getProcAddress(name string) uintptr { if c.isES { - const ext = "EXT" - if strings.HasSuffix(name, ext) { - name = name[:len(name)-len(ext)] - } + name = strings.TrimSuffix(name, "EXT") } return purego.Dlsym(opengl, name) } diff --git a/internal/graphicsdriver/opengl/gl/procaddr_others.go b/internal/graphicsdriver/opengl/gl/procaddr_others.go index 57d34e1c0..064f883af 100644 --- a/internal/graphicsdriver/opengl/gl/procaddr_others.go +++ b/internal/graphicsdriver/opengl/gl/procaddr_others.go @@ -106,9 +106,8 @@ func getProcAddressGL(name string) unsafe.Pointer { } func getProcAddressGLES(name string) unsafe.Pointer { - const ext = "EXT" if strings.HasSuffix(name, ext) { - name = name[:len(name)-len(ext)] + name = strings.TrimSuffix(name, "EXT") } cname := C.CString(name) defer C.free(unsafe.Pointer(cname))