提交 6a624356 编写于 作者: B bernard

[Finsh] code cleanup

上级 1f8a0668
......@@ -69,6 +69,8 @@ typedef unsigned long u_long;
!defined(__ADSPBLACKFIN__) && \
!defined(_MSC_VER)
/* only for GNU GCC */
#if !(defined(__GNUC__) && defined(__x86_64__))
typedef unsigned int size_t;
#else
......@@ -79,13 +81,6 @@ typedef unsigned int size_t;
#define NULL RT_NULL
#endif
#define memset rt_memset
#define strlen rt_strlen
#define strncpy rt_strncpy
#define strncmp rt_strncmp
int strcmp (const char *s1, const char *s2);
char *strdup(const char *s);
#else
/* use libc of armcc */
#include <ctype.h>
......@@ -94,8 +89,8 @@ char *strdup(const char *s);
#endif
#endif
#define FINSH_VERSION_MAJOR 0
#define FINSH_VERSION_MINOR 5
#define FINSH_VERSION_MAJOR 1
#define FINSH_VERSION_MINOR 0
/**
* @addtogroup finsh
......
此差异已折叠。
......@@ -473,17 +473,16 @@ static int token_proc_escape(struct finsh_token* self)
static void token_proc_number(struct finsh_token* self)
{
char ch;
int b;
char *p, buf[128];
long value;
value = 0;
p = buf;
b = 10;
ch = token_next_char(self);
if ( ch == '0' )
{
int b;
ch = token_next_char(self);
if ( ch == 'x' || ch == 'X' )/*it's a hex number*/
{
......
......@@ -104,7 +104,6 @@ struct finsh_var* finsh_var_lookup(const char* name)
}
#ifdef RT_USING_HEAP
extern char *strdup(const char *s);
void finsh_sysvar_append(const char* name, u_char type, void* var_addr)
{
/* create a sysvar */
......@@ -114,7 +113,7 @@ void finsh_sysvar_append(const char* name, u_char type, void* var_addr)
if (item != NULL)
{
item->next = NULL;
item->sysvar.name = strdup(name);
item->sysvar.name = rt_strdup(name);
item->sysvar.type = type;
item->sysvar.var = var_addr;
......
......@@ -72,7 +72,6 @@ void finsh_vm_run()
}
#ifdef RT_USING_HEAP
extern char *strdup(const char *s);
void finsh_syscall_append(const char* name, syscall_func func)
{
/* create the syscall */
......@@ -82,7 +81,7 @@ void finsh_syscall_append(const char* name, syscall_func func)
if (item != RT_NULL)
{
item->next = NULL;
item->syscall.name = strdup(name);
item->syscall.name = rt_strdup(name);
item->syscall.func = func;
if (global_syscall_list == NULL)
......
......@@ -54,29 +54,6 @@ ALIGN(RT_ALIGN_SIZE)
static char finsh_thread_stack[FINSH_THREAD_STACK_SIZE];
struct finsh_shell* shell;
#if !defined (RT_USING_NEWLIB) && !defined (RT_USING_MINILIBC)
int strcmp (const char *s1, const char *s2)
{
while (*s1 && *s1 == *s2) s1++, s2++;
return (*s1 - *s2);
}
#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
#endif
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
#include <dfs_posix.h>
const char* finsh_get_prompt()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册