MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / countNewLines

Method countNewLines

xmlparser/decoder.go:864–874  ·  view source on GitHub ↗

countNewLines counts the number of new lines in the given byte slice and increments the decoder's line counter accordingly.

(b []byte)

Source from the content-addressed store, hash-verified

862// countNewLines counts the number of new lines in the given byte slice
863// and increments the decoder's line counter accordingly.
864func (d *Decoder) countNewLines(b []byte) {
865 // Somehow this is more efficient than bytes.Count...
866 for {
867 ind := bytes.IndexByte(b, '\n')
868 if ind < 0 {
869 break
870 }
871 d.line++
872 b = b[ind+1:]
873 }
874}
875
876// setSyntaxErrorf sets a syntax error with the current line number.
877func (d *Decoder) setSyntaxErrorf(format string, a ...any) {

Callers 2

readUntilMethod · 0.95
discardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected