MCPcopy
hub / github.com/buger/jsonparser / isSameMemory

Function isSameMemory

escape_test.go:142–154  ·  view source on GitHub ↗

isSameMemory checks if two slices contain the same memory pointer (meaning one is a subslice of the other, with possibly differing lengths/capacities). Test helper for SYS-REQ-014.

(a, b []byte)

Source from the content-addressed store, hash-verified

140// subslice of the other, with possibly differing lengths/capacities).
141// Test helper for SYS-REQ-014.
142func isSameMemory(a, b []byte) bool {
143 if cap(a) == 0 || cap(b) == 0 {
144 return cap(a) == cap(b)
145 } else if a, b = a[:1], b[:1]; a[0] != b[0] {
146 return false
147 } else {
148 a[0]++
149 same := (a[0] == b[0])
150 a[0]--
151 return same
152 }
153
154}
155
156// Verifies: SYS-REQ-014 [malformed]
157// MCDC SYS-REQ-014: N/A

Callers 1

TestUnescapeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…