HAL_ChibiOS: added vsnprintf wrapper

this allows us to use a common snprintf implementation
This commit is contained in:
Andrew Tridgell 2019-09-08 20:54:35 +10:00
parent e9960067c6
commit 3166f84954
2 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,7 @@ extern "C" {
int vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
int __wrap_snprintf(char *str, size_t size, const char *fmt, ...);
int __wrap_vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
int snprintf(char *str, size_t size, const char *fmt, ...); //undefined, only used as a placeholder, its replaced by wrap method at link time
int vasprintf(char **strp, const char *fmt, va_list ap);
int asprintf(char **strp, const char *fmt, ...);

View File

@ -44,6 +44,11 @@ int __wrap_snprintf(char *str, size_t size, const char *fmt, ...)
return done;
}
int __wrap_vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
{
return hal.util->vsnprintf(str, size, fmt, ap);
}
int vasprintf(char **strp, const char *fmt, va_list ap)
{
int len = vsnprintf(NULL, 0, fmt, ap);