File tree Expand file tree Collapse file tree 2 files changed +13
-46
lines changed
components/libc/compilers/newlib Expand file tree Collapse file tree 2 files changed +13
-46
lines changed Original file line number Diff line number Diff line change @@ -32,52 +32,6 @@ ALIGN(RT_ALIGN_SIZE)
3232static char finsh_thread_stack [FINSH_THREAD_STACK_SIZE ];
3333struct finsh_shell * shell ;
3434
35- #ifdef RT_USING_HEAP
36- char * strdup (const char * s )
37- {
38- size_t len = strlen (s ) + 1 ;
39- char * tmp = (char * )rt_malloc (len );
40-
41- if (!tmp ) return NULL ;
42-
43- rt_memcpy (tmp , s , len );
44- return tmp ;
45- }
46- #endif
47-
48- #if !defined(__CC_ARM ) && !defined(__IAR_SYSTEMS_ICC__ )
49- int isalpha ( int ch )
50- {
51- return (unsigned int )((ch | 0x20 ) - 'a' ) < 26u ;
52- }
53-
54- int atoi (const char * s )
55- {
56- long int v = 0 ;
57- int sign = 1 ;
58- while ( * s == ' ' || (unsigned int )(* s - 9 ) < 5u ) s ++ ;
59-
60- switch (* s )
61- {
62- case '-' : sign = -1 ;
63- case '+' : ++ s ;
64- }
65-
66- while ((unsigned int ) (* s - '0' ) < 10u )
67- {
68- v = v * 10 + * s - '0' ; ++ s ;
69- }
70-
71- return sign == -1 ?- v :v ;
72- }
73-
74- int isprint (unsigned char ch )
75- {
76- return (unsigned int )(ch - ' ' ) < 127u - ' ' ;
77- }
78- #endif
79- #endif
80-
8135#if defined(RT_USING_DFS ) && defined(DFS_USING_WORKDIR )
8236#include <dfs_posix.h>
8337const char * finsh_get_prompt (void )
Original file line number Diff line number Diff line change @@ -16,3 +16,16 @@ void * _sbrk_r(struct _reent *ptr, ptrdiff_t incr)
1616 /* no use this routine to get memory */
1717 return RT_NULL ;
1818}
19+
20+ #ifdef RT_USING_HEAP
21+ char * strdup (const char * s )
22+ {
23+ size_t len = strlen (s ) + 1 ;
24+ char * tmp = (char * )rt_malloc (len );
25+
26+ if (!tmp ) return NULL ;
27+
28+ rt_memcpy (tmp , s , len );
29+ return tmp ;
30+ }
31+ #endif /*RT_USING_HEAP*/
You can’t perform that action at this time.
0 commit comments