1// Copyright 2018 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package unix_test 6 7// stringsFromByteSlice converts a sequence of attributes to a []string. 8// On Darwin, each entry is a NULL-terminated string. 9func stringsFromByteSlice(buf []byte) []string { 10 var result []string 11 off := 0 12 for i, b := range buf { 13 if b == 0 { 14 result = append(result, string(buf[off:i])) 15 off = i + 1 16 } 17 } 18 return result 19} 20