aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/syscall/str.go
blob: b73490a20fbb97bb6b472e9d29bc94a939911335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package syscall

// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
func clen(n []byte) int {
	for i := 0; i < len(n); i++ {
		if n[i] == 0 {
			return i
		}
	}
	return len(n)
}