| 768 | } |
| 769 | |
| 770 | int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) |
| 771 | { |
| 772 | struct vsnprintf_data data = { size, 0, str }; |
| 773 | struct printf_spec ps = { vsnprintf_write, &data }; |
| 774 | |
| 775 | /* Print 0 at end of string - fix case that nothing will be printed. */ |
| 776 | if (size > 0) |
| 777 | str[0] = 0; |
| 778 | |
| 779 | /* vsnprintf_write() ensures that str will be terminated by zero. */ |
| 780 | return printf_core(fmt, &ps, ap); |
| 781 | } |
| 782 | |
| 783 | int vsprintf(char *str, const char *fmt, va_list ap) |
| 784 | { |
no test coverage detected