diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gos/chibios.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gos/chibios.c b/src/gos/chibios.c index 6ce06d94..0b501110 100644 --- a/src/gos/chibios.c +++ b/src/gos/chibios.c @@ -13,6 +13,8 @@ #if GFX_USE_OS_CHIBIOS +#include <string.h> + #if !CH_USE_MUTEXES #error "GOS: CH_USE_MUTEXES must be defined in chconf.h" #endif @@ -29,6 +31,22 @@ void _gosInit(void) { } } +void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz) { + void *np; + + if (newsz <= oldsz) + return ptr; + + np = gfxAlloc(newsz); + if (!np) + return 0; + + if (oldsz) + memcpy(np, ptr, oldsz); + + return np; +} + void gfxSleepMilliseconds(delaytime_t ms) { switch(ms) { case TIME_IMMEDIATE: chThdYield(); return; |
