File: bytes_safe.go

package info (click to toggle)
golang-github-buger-jsonparser 0.0~git20170705.0.9addec9-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 636 kB
  • sloc: makefile: 29
file content (25 lines) | stat: -rw-r--r-- 479 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// +build appengine appenginevm

package jsonparser

import (
	"strconv"
)

// See fastbytes_unsafe.go for explanation on why *[]byte is used (signatures must be consistent with those in that file)

func equalStr(b *[]byte, s string) bool {
	return string(*b) == s
}

func parseFloat(b *[]byte) (float64, error) {
	return strconv.ParseFloat(string(*b), 64)
}

func bytesToString(b *[]byte) string {
	return string(*b)
}

func StringToBytes(s string) []byte {
	return []byte(s)
}