str.mx raw

   1  // Copyright 2009 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  
   5  //go:build !unix
   6  
   7  package syscall
   8  
   9  // clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
  10  func clen(n []byte) int {
  11  	for i := 0; i < len(n); i++ {
  12  		if n[i] == 0 {
  13  			return i
  14  		}
  15  	}
  16  	return len(n)
  17  }
  18