MCPcopy Create free account
hub / github.com/git/git / sq_quote_buf_pretty

Function sq_quote_buf_pretty

quote.c:50–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void sq_quote_buf_pretty(struct strbuf *dst, const char *src)
51{
52 static const char ok_punct[] = "+,-./:=@_^";
53 const char *p;
54
55 /* Avoid losing a zero-length string by adding '' */
56 if (!*src) {
57 strbuf_addstr(dst, "''");
58 return;
59 }
60
61 for (p = src; *p; p++) {
62 if (!isalnum(*p) && !strchr(ok_punct, *p)) {
63 sq_quote_buf(dst, src);
64 return;
65 }
66 }
67
68 /* if we get here, we did not need quoting */
69 strbuf_addstr(dst, src);
70}
71
72void sq_quotef(struct strbuf *dst, const char *fmt, ...)
73{

Callers 10

add_config_scope_argFunction · 0.85
trace_add_envFunction · 0.85
trace_run_commandFunction · 0.85
fn_child_start_flFunction · 0.85
fn_repo_flFunction · 0.85
fn_child_start_flFunction · 0.85
fn_repo_flFunction · 0.85

Calls 2

strbuf_addstrFunction · 0.85
sq_quote_bufFunction · 0.85

Tested by

no test coverage detected