Browse Source

HAL_ChibiOS: added vsnprintf wrapper

this allows us to use a common snprintf implementation
mission-4.1.18
Andrew Tridgell 5 years ago
parent
commit
3166f84954
  1. 1
      libraries/AP_HAL_ChibiOS/hwdef/common/stdio.h
  2. 5
      libraries/AP_HAL_ChibiOS/stdio.cpp

1
libraries/AP_HAL_ChibiOS/hwdef/common/stdio.h

@ -26,6 +26,7 @@ extern "C" { @@ -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, ...);

5
libraries/AP_HAL_ChibiOS/stdio.cpp

@ -44,6 +44,11 @@ int __wrap_snprintf(char *str, size_t size, const char *fmt, ...) @@ -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);

Loading…
Cancel
Save