mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Integrate public as bindata optionally (#293)
* Dropped unused codekit config * Integrated dynamic and static bindata for public * Ignore public bindata * Add a general generate make task * Integrated flexible public assets into web command * Updated vendoring, added all missiong govendor deps * Made the linter happy with the bindata and dynamic code * Moved public bindata definition to modules directory * Ignoring the new bindata path now * Updated to the new public modules import path * Updated public bindata command and drop the new prefix
This commit is contained in:
		
				
					committed by
					
						
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							4680c349dd
						
					
				
				
					commit
					b6a95a8cb3
				
			
							
								
								
									
										49
									
								
								vendor/github.com/ugorji/go/codec/helper_unsafe.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								vendor/github.com/ugorji/go/codec/helper_unsafe.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
//+build unsafe
 | 
			
		||||
 | 
			
		||||
// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a MIT license found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
package codec
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This file has unsafe variants of some helper methods.
 | 
			
		||||
 | 
			
		||||
type unsafeString struct {
 | 
			
		||||
	Data uintptr
 | 
			
		||||
	Len  int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type unsafeSlice struct {
 | 
			
		||||
	Data uintptr
 | 
			
		||||
	Len  int
 | 
			
		||||
	Cap  int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// stringView returns a view of the []byte as a string.
 | 
			
		||||
// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
 | 
			
		||||
// In regular safe mode, it is an allocation and copy.
 | 
			
		||||
func stringView(v []byte) string {
 | 
			
		||||
	if len(v) == 0 {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bx := (*unsafeSlice)(unsafe.Pointer(&v))
 | 
			
		||||
	sx := unsafeString{bx.Data, bx.Len}
 | 
			
		||||
	return *(*string)(unsafe.Pointer(&sx))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// bytesView returns a view of the string as a []byte.
 | 
			
		||||
// In unsafe mode, it doesn't incur allocation and copying caused by conversion.
 | 
			
		||||
// In regular safe mode, it is an allocation and copy.
 | 
			
		||||
func bytesView(v string) []byte {
 | 
			
		||||
	if len(v) == 0 {
 | 
			
		||||
		return zeroByteSlice
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sx := (*unsafeString)(unsafe.Pointer(&v))
 | 
			
		||||
	bx := unsafeSlice{sx.Data, sx.Len, sx.Len}
 | 
			
		||||
	return *(*[]byte)(unsafe.Pointer(&bx))
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user