From bd2e288e56ebf50c9038f3069d07a5e3085030f1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 9 Mar 2020 17:02:53 +0100 Subject: [PATCH] pkg/system: remove unused CommandLineToArgv This function was added in 9c4570a958df42d1ad19364b1a8da55b891d850a, but appears to never have been used. Removing it, as it's not used in the codebase and, from a quick search on GitHub, also doesn't look to be used by other projects. Signed-off-by: Sebastiaan van Stijn --- pkg/system/syscall_unix.go | 6 ------ pkg/system/syscall_windows.go | 23 ----------------------- 2 files changed, 29 deletions(-) diff --git a/pkg/system/syscall_unix.go b/pkg/system/syscall_unix.go index 919a412a7b..905d10f153 100644 --- a/pkg/system/syscall_unix.go +++ b/pkg/system/syscall_unix.go @@ -9,9 +9,3 @@ import "golang.org/x/sys/unix" func Unmount(dest string) error { return unix.Unmount(dest, 0) } - -// CommandLineToArgv should not be used on Unix. -// It simply returns commandLine in the only element in the returned array. -func CommandLineToArgv(commandLine string) ([]string, error) { - return []string{commandLine}, nil -} diff --git a/pkg/system/syscall_windows.go b/pkg/system/syscall_windows.go index e81fe3c300..b668342492 100644 --- a/pkg/system/syscall_windows.go +++ b/pkg/system/syscall_windows.go @@ -104,29 +104,6 @@ func Unmount(_ string) error { return nil } -// CommandLineToArgv wraps the Windows syscall to turn a commandline into an argument array. -func CommandLineToArgv(commandLine string) ([]string, error) { - var argc int32 - - argsPtr, err := windows.UTF16PtrFromString(commandLine) - if err != nil { - return nil, err - } - - argv, err := windows.CommandLineToArgv(argsPtr, &argc) - if err != nil { - return nil, err - } - defer windows.LocalFree(windows.Handle(uintptr(unsafe.Pointer(argv)))) - - newArgs := make([]string, argc) - for i, v := range (*argv)[:argc] { - newArgs[i] = windows.UTF16ToString((*v)[:]) - } - - return newArgs, nil -} - // HasWin32KSupport determines whether containers that depend on win32k can // run on this machine. Win32k is the driver used to implement windowing. func HasWin32KSupport() bool {