Skip to content

Commit

Permalink
Leave allocation capacity guessing to the runtime (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp committed Dec 17, 2022
1 parent 2975a21 commit 25a5fe4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion jsoninfo/marshal.go
Expand Up @@ -23,7 +23,7 @@ type ObjectEncoder struct {

func NewObjectEncoder() *ObjectEncoder {
return &ObjectEncoder{
result: make(map[string]json.RawMessage, 8),
result: make(map[string]json.RawMessage),
}
}

Expand Down
4 changes: 2 additions & 2 deletions openapi2/openapi2.go
Expand Up @@ -42,7 +42,7 @@ func (doc *T) UnmarshalJSON(data []byte) error {
func (doc *T) AddOperation(path string, method string, operation *Operation) {
paths := doc.Paths
if paths == nil {
paths = make(map[string]*PathItem, 8)
paths = make(map[string]*PathItem)
doc.Paths = paths
}
pathItem := paths[path]
Expand Down Expand Up @@ -77,7 +77,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error {
}

func (pathItem *PathItem) Operations() map[string]*Operation {
operations := make(map[string]*Operation, 8)
operations := make(map[string]*Operation)
if v := pathItem.Delete; v != nil {
operations[http.MethodDelete] = v
}
Expand Down
2 changes: 1 addition & 1 deletion openapi2conv/openapi2_conv.go
Expand Up @@ -1206,7 +1206,7 @@ func stripNonCustomExtensions(extensions map[string]interface{}) {
func addPathExtensions(doc2 *openapi2.T, path string, extensionProps openapi3.ExtensionProps) {
paths := doc2.Paths
if paths == nil {
paths = make(map[string]*openapi2.PathItem, 8)
paths = make(map[string]*openapi2.PathItem)
doc2.Paths = paths
}
pathItem := paths[path]
Expand Down
2 changes: 1 addition & 1 deletion openapi3/content.go
Expand Up @@ -10,7 +10,7 @@ import (
type Content map[string]*MediaType

func NewContent() Content {
return make(map[string]*MediaType, 4)
return make(map[string]*MediaType)
}

func NewContentWithSchema(schema *Schema, consumes []string) Content {
Expand Down
2 changes: 1 addition & 1 deletion openapi3/path_item.go
Expand Up @@ -41,7 +41,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error {
}

func (pathItem *PathItem) Operations() map[string]*Operation {
operations := make(map[string]*Operation, 4)
operations := make(map[string]*Operation)
if v := pathItem.Connect; v != nil {
operations[http.MethodConnect] = v
}
Expand Down
2 changes: 1 addition & 1 deletion routers/legacy/router.go
Expand Up @@ -124,7 +124,7 @@ func (router *Router) FindRoute(req *http.Request) (*routers.Route, map[string]s
Reason: routers.ErrPathNotFound.Error(),
}
}
pathParams = make(map[string]string, 8)
pathParams = make(map[string]string)
paramNames, err := server.ParameterNames()
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 25a5fe4

Please sign in to comment.