* 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. */
| 33 | * behavior. |
| 34 | */ |
| 35 | static 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 | |
| 47 | static int str_len (lua_State *L) { |
no test coverage detected