diff options
| author | Meco Man <[email protected]> | 2021-02-23 10:28:13 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-02-23 10:28:13 +0800 |
| commit | 9220447060be5996c9065f26ab8358f6b19f258e (patch) | |
| tree | b8742b1a9484f1e7a2c6d33e5e03e5bf0fc4918a /components | |
| parent | 497e7b45d489802a16bf2bba97efa7f303e88206 (diff) | |
update
Diffstat (limited to 'components')
| -rw-r--r-- | components/libc/compilers/newlib/minilib.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/components/libc/compilers/newlib/minilib.c b/components/libc/compilers/newlib/minilib.c index 2d07eabe5a..1210880b96 100644 --- a/components/libc/compilers/newlib/minilib.c +++ b/components/libc/compilers/newlib/minilib.c @@ -16,3 +16,16 @@ void * _sbrk_r(struct _reent *ptr, ptrdiff_t incr) /* no use this routine to get memory */ return RT_NULL; } + +#ifdef RT_USING_HEAP +char *strdup(const char *s) +{ + size_t len = strlen(s) + 1; + char *tmp = (char *)rt_malloc(len); + + if(!tmp) return NULL; + + rt_memcpy(tmp, s, len); + return tmp; +} +#endif /*RT_USING_HEAP*/ |
