Home / Function/ bufApp() — gin Function Reference

bufApp() — gin Function Reference

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

Function go GinCore Routing called by 2

Entity Profile

Dependency Diagram

graph TD
  c9e13c4f_e8ac_23df_c197_fd4f4a014ce5["bufApp()"]
  2cd24ad1_a2fb_ea62_1740_f464205e2482["path.go"]
  c9e13c4f_e8ac_23df_c197_fd4f4a014ce5 -->|defined in| 2cd24ad1_a2fb_ea62_1740_f464205e2482
  e9bfd7f3_f139_ccbb_bda3_81e1d2a0636c["cleanPath()"]
  e9bfd7f3_f139_ccbb_bda3_81e1d2a0636c -->|calls| c9e13c4f_e8ac_23df_c197_fd4f4a014ce5
  1e0289fd_288d_87a1_00a7_d49ab776a179["removeRepeatedChar()"]
  1e0289fd_288d_87a1_00a7_d49ab776a179 -->|calls| c9e13c4f_e8ac_23df_c197_fd4f4a014ce5
  style c9e13c4f_e8ac_23df_c197_fd4f4a014ce5 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

Defined In

Frequently Asked Questions

What does bufApp() do?
bufApp() is a function in the gin codebase, defined in path.go.
Where is bufApp() defined?
bufApp() is defined in path.go at line 128.
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