Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

20 linhas
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. }