| 168 | } |
| 169 | |
| 170 | int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) |
| 171 | { |
| 172 | vsnprintf_data_t data = { |
| 173 | size, |
| 174 | 0, |
| 175 | str |
| 176 | }; |
| 177 | printf_spec_t ps = { |
| 178 | (int (*) (const char *, size_t, void *)) vsnprintf_str_write, |
| 179 | (int (*) (const char32_t *, size_t, void *)) vsnprintf_wstr_write, |
| 180 | &data |
| 181 | }; |
| 182 | |
| 183 | /* Print 0 at end of string - fix the case that nothing will be printed */ |
| 184 | if (size > 0) |
| 185 | str[0] = 0; |
| 186 | |
| 187 | /* vsnprintf_write ensures that str will be terminated by zero. */ |
| 188 | return printf_core(fmt, &ps, ap); |
| 189 | } |
| 190 | |
| 191 | /** @} |
| 192 | */ |
no test coverage detected