Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

syscall_darwin_test.go 511 B

12345678910111213141516171819
  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. }