mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 18:22:26 -05:00 
			
		
		
		
	[chore]: Bump golang.org/x/net from 0.17.0 to 0.18.0 (#2390)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.18.0. - [Commits](https://github.com/golang/net/compare/v0.17.0...v0.18.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
		
					parent
					
						
							
								c334df8f43
							
						
					
				
			
			
				commit
				
					
						5c17ecd93a
					
				
			
		
					 168 changed files with 119 additions and 372 deletions
				
			
		
							
								
								
									
										59
									
								
								vendor/golang.org/x/net/http2/databuffer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										59
									
								
								vendor/golang.org/x/net/http2/databuffer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -20,41 +20,44 @@ import ( | |||
| // TODO: Benchmark to determine if the pools are necessary. The GC may have | ||||
| // improved enough that we can instead allocate chunks like this: | ||||
| // make([]byte, max(16<<10, expectedBytesRemaining)) | ||||
| var ( | ||||
| 	dataChunkSizeClasses = []int{ | ||||
| 		1 << 10, | ||||
| 		2 << 10, | ||||
| 		4 << 10, | ||||
| 		8 << 10, | ||||
| 		16 << 10, | ||||
| 	} | ||||
| 	dataChunkPools = [...]sync.Pool{ | ||||
| 		{New: func() interface{} { return make([]byte, 1<<10) }}, | ||||
| 		{New: func() interface{} { return make([]byte, 2<<10) }}, | ||||
| 		{New: func() interface{} { return make([]byte, 4<<10) }}, | ||||
| 		{New: func() interface{} { return make([]byte, 8<<10) }}, | ||||
| 		{New: func() interface{} { return make([]byte, 16<<10) }}, | ||||
| 	} | ||||
| ) | ||||
| var dataChunkPools = [...]sync.Pool{ | ||||
| 	{New: func() interface{} { return new([1 << 10]byte) }}, | ||||
| 	{New: func() interface{} { return new([2 << 10]byte) }}, | ||||
| 	{New: func() interface{} { return new([4 << 10]byte) }}, | ||||
| 	{New: func() interface{} { return new([8 << 10]byte) }}, | ||||
| 	{New: func() interface{} { return new([16 << 10]byte) }}, | ||||
| } | ||||
| 
 | ||||
| func getDataBufferChunk(size int64) []byte { | ||||
| 	i := 0 | ||||
| 	for ; i < len(dataChunkSizeClasses)-1; i++ { | ||||
| 		if size <= int64(dataChunkSizeClasses[i]) { | ||||
| 			break | ||||
| 		} | ||||
| 	switch { | ||||
| 	case size <= 1<<10: | ||||
| 		return dataChunkPools[0].Get().(*[1 << 10]byte)[:] | ||||
| 	case size <= 2<<10: | ||||
| 		return dataChunkPools[1].Get().(*[2 << 10]byte)[:] | ||||
| 	case size <= 4<<10: | ||||
| 		return dataChunkPools[2].Get().(*[4 << 10]byte)[:] | ||||
| 	case size <= 8<<10: | ||||
| 		return dataChunkPools[3].Get().(*[8 << 10]byte)[:] | ||||
| 	default: | ||||
| 		return dataChunkPools[4].Get().(*[16 << 10]byte)[:] | ||||
| 	} | ||||
| 	return dataChunkPools[i].Get().([]byte) | ||||
| } | ||||
| 
 | ||||
| func putDataBufferChunk(p []byte) { | ||||
| 	for i, n := range dataChunkSizeClasses { | ||||
| 		if len(p) == n { | ||||
| 			dataChunkPools[i].Put(p) | ||||
| 			return | ||||
| 		} | ||||
| 	switch len(p) { | ||||
| 	case 1 << 10: | ||||
| 		dataChunkPools[0].Put((*[1 << 10]byte)(p)) | ||||
| 	case 2 << 10: | ||||
| 		dataChunkPools[1].Put((*[2 << 10]byte)(p)) | ||||
| 	case 4 << 10: | ||||
| 		dataChunkPools[2].Put((*[4 << 10]byte)(p)) | ||||
| 	case 8 << 10: | ||||
| 		dataChunkPools[3].Put((*[8 << 10]byte)(p)) | ||||
| 	case 16 << 10: | ||||
| 		dataChunkPools[4].Put((*[16 << 10]byte)(p)) | ||||
| 	default: | ||||
| 		panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) | ||||
| 	} | ||||
| 	panic(fmt.Sprintf("unexpected buffer len=%v", len(p))) | ||||
| } | ||||
| 
 | ||||
| // dataBuffer is an io.ReadWriter backed by a list of data chunks. | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue