Home / Function/ bufApp() — gin Function Reference

bufApp() — gin Function Reference

Architecture documentation for the bufApp() function in path.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  900407ca_06e1_6993_0fcb_3023e51081c8["bufApp()"]
  07327532_31e2_92aa_0459_2e877d100a48["cleanPath()"]
  07327532_31e2_92aa_0459_2e877d100a48 -->|calls| 900407ca_06e1_6993_0fcb_3023e51081c8
  a665bfd6_6cb2_f9b7_dba0_b277247d1360["removeRepeatedChar()"]
  a665bfd6_6cb2_f9b7_dba0_b277247d1360 -->|calls| 900407ca_06e1_6993_0fcb_3023e51081c8
  style 900407ca_06e1_6993_0fcb_3023e51081c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

path.go lines 128–151

func bufApp(buf *[]byte, s string, w int, c byte) {
	b := *buf
	if len(b) == 0 {
		// No modification of the original string so far.
		// If the next character is the same as in the original string, we do
		// not yet have to allocate a buffer.
		if s[w] == c {
			return
		}

		// Otherwise use either the stack buffer, if it is large enough, or
		// allocate a new buffer on the heap, and copy all previous characters.
		length := len(s)
		if length > cap(b) {
			*buf = make([]byte, length)
		} else {
			*buf = (*buf)[:length]
		}
		b = *buf

		copy(b, s[:w])
	}
	b[w] = c
}

Domain

Subdomains

Frequently Asked Questions

What does bufApp() do?
bufApp() is a function in the gin codebase.
What calls bufApp()?
bufApp() is called by 2 function(s): cleanPath, removeRepeatedChar.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free