fillIndex finds the position of Raw data and assigns it to the Index field of the resulting value. If the position cannot be found then Index zero is used instead.
(json string, c *parseContext)
| 3347 | // of the resulting value. If the position cannot be found then Index zero is |
| 3348 | // used instead. |
| 3349 | func fillIndex(json string, c *parseContext) { |
| 3350 | if len(c.value.Raw) > 0 && !c.calcd { |
| 3351 | jhdr := *(*stringHeader)(unsafe.Pointer(&json)) |
| 3352 | rhdr := *(*stringHeader)(unsafe.Pointer(&(c.value.Raw))) |
| 3353 | c.value.Index = int(uintptr(rhdr.data) - uintptr(jhdr.data)) |
| 3354 | if c.value.Index < 0 || c.value.Index >= len(json) { |
| 3355 | c.value.Index = 0 |
| 3356 | } |
| 3357 | } |
| 3358 | } |
| 3359 | |
| 3360 | func stringBytes(s string) []byte { |
| 3361 | return *(*[]byte)(unsafe.Pointer(&sliceHeader{ |
no outgoing calls
no test coverage detected
searching dependent graphs…