MCPcopy Create free account
hub / github.com/F-Stack/f-stack / str_sprintf

Function str_sprintf

freebsd/contrib/openzfs/module/lua/lstrlib.c:35–44  ·  view source on GitHub ↗

* The provided version of sprintf returns a char *, but str_format expects * it to return the number of characters printed. This version has the expected * behavior. */

Source from the content-addressed store, hash-verified

33 * behavior.
34 */
35static size_t str_sprintf(char *buf, const char *fmt, ...) {
36 va_list args;
37 size_t len;
38
39 va_start(args, fmt);
40 len = vsnprintf(buf, INT_MAX, fmt, args);
41 va_end(args);
42
43 return len;
44}
45
46
47static int str_len (lua_State *L) {

Callers 1

str_formatFunction · 0.85

Calls 1

vsnprintfFunction · 0.85

Tested by

no test coverage detected