MCPcopy
hub / github.com/tinylib/msgp / writeLimitConstants

Function writeLimitConstants

printer/print.go:152–168  ·  view source on GitHub ↗
(b *bytes.Buffer, file string, f *parse.FileSet)

Source from the content-addressed store, hash-verified

150}
151
152func writeLimitConstants(b *bytes.Buffer, file string, f *parse.FileSet) {
153 if f.ArrayLimit != math.MaxUint32 || f.MapLimit != math.MaxUint32 {
154 prefix := generateFilePrefix(file)
155 b.WriteString("// Size limits for msgp deserialization\n")
156 b.WriteString("const (\n")
157 if f.ArrayLimit != math.MaxUint32 {
158 fmt.Fprintf(b, "\t%slimitArrays = %d\n", prefix, f.ArrayLimit)
159 }
160 if f.MapLimit != math.MaxUint32 {
161 fmt.Fprintf(b, "\t%slimitMaps = %d\n", prefix, f.MapLimit)
162 }
163 b.WriteString(")\n\n")
164
165 // Store the prefix in FileSet so generators can use it
166 f.LimitPrefix = prefix
167 }
168}

Callers 1

generateFunction · 0.85

Calls 2

generateFilePrefixFunction · 0.85
WriteStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…