MCPcopy Create free account
hub / github.com/apache/trafficserver / getFormat

Method getFormat

include/proxy/http/HttpBodyFactory.h:184–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182 char *content_type_out_buf, size_t content_type_buf_size, int format_size, const char *format);
183
184 char *
185 getFormat(int64_t max_buffer_length, int64_t *resulting_buffer_length, const char *format, ...)
186 {
187 char *msg = nullptr;
188 if (format) {
189 va_list ap;
190
191 va_start(ap, format);
192
193 // The length from ink_bvsprintf includes the trailing NUL, so adjust the final
194 // length accordingly. Note that ink_bvsprintf() copies the va_list, so we only
195 // have to set it up once.
196 int l = ink_bvsprintf(nullptr, format, ap);
197
198 if (l <= max_buffer_length) {
199 msg = (char *)ats_malloc(l);
200 *resulting_buffer_length = ink_bvsprintf(msg, format, ap) - 1;
201 }
202 va_end(ap);
203 }
204 return msg;
205 }
206
207 void dump_template_tables(FILE *fp = stderr);
208 void reconfigure();

Callers 1

Calls 2

ink_bvsprintfFunction · 0.85
ats_mallocFunction · 0.85

Tested by

no test coverage detected