您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

20 行
511 B

  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. package unix_test
  5. // stringsFromByteSlice converts a sequence of attributes to a []string.
  6. // On Darwin, each entry is a NULL-terminated string.
  7. func stringsFromByteSlice(buf []byte) []string {
  8. var result []string
  9. off := 0
  10. for i, b := range buf {
  11. if b == 0 {
  12. result = append(result, string(buf[off:i]))
  13. off = i + 1
  14. }
  15. }
  16. return result
  17. }