a668cd296b
rename template file and functions to reduce bandwidth usage replace x-loggedin with theoretically faster x-mem remove redundant check in ua loop move extraData initialisation down to where it's needed
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
//"reflect"
|
|
//"runtime"
|
|
//"unsafe"
|
|
"github.com/Azareal/Gosora/uutils"
|
|
)
|
|
|
|
// TODO: Add a safe build mode for things like Google Appengine
|
|
|
|
var GetFrag = func(name string) [][]byte {
|
|
return nil
|
|
}
|
|
|
|
type WriteString interface {
|
|
WriteString(s string) (n int, err error)
|
|
}
|
|
|
|
var StringToBytes = uutils.StringToBytes
|
|
var BytesToString = uutils.BytesToString
|
|
var Nanotime = uutils.Nanotime
|
|
|
|
/*
|
|
func StringToBytes(s string) (bytes []byte) {
|
|
str := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
|
slice := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))
|
|
slice.Data = str.Data
|
|
slice.Len = str.Len
|
|
slice.Cap = str.Len
|
|
runtime.KeepAlive(&s)
|
|
return bytes
|
|
}
|
|
func BytesToString(bytes []byte) (s string) {
|
|
slice := (*reflect.SliceHeader)(unsafe.Pointer(&bytes))
|
|
str := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
|
str.Data = slice.Data
|
|
str.Len = slice.Len
|
|
runtime.KeepAlive(&bytes)
|
|
return s
|
|
}
|
|
//go:noescape
|
|
//go:linkname nanotime runtime.nanotime
|
|
func nanotime() int64
|
|
func Nanotime() int64 {
|
|
return nanotime()
|
|
}*/
|