Merge pull request #353 from grissiom/misc-fix

Misc fix
This commit is contained in:
Bernard Xiong 2014-10-14 23:24:02 +08:00
commit 2fc3db6579
5 changed files with 11 additions and 1 deletions

View File

@ -335,6 +335,9 @@ int dfs_file_lseek(struct dfs_fd *fd, rt_off_t offset)
if (fd == RT_NULL)
return -DFS_STATUS_EINVAL;
fs = fd->fs;
if (fs == RT_NULL)
return -DFS_STATUS_EINVAL;
if (fs->ops->lseek == RT_NULL)
return -DFS_STATUS_ENOSYS;

View File

@ -358,6 +358,9 @@ void msh_auto_complete_path(char *path)
struct dirent *dirent = RT_NULL;
char *full_path, *ptr, *index;
if (!path)
return;
full_path = (char*)rt_malloc(256);
if (full_path == RT_NULL) return; /* out of memory */

View File

@ -276,6 +276,7 @@ int cmd_time(int argc, char** argv)
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_time, __cmd_time, Execute command with time.);
#ifdef RT_USING_HEAP
int cmd_free(int argc, char** argv)
{
extern void list_mem(void);
@ -284,6 +285,7 @@ int cmd_free(int argc, char** argv)
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_free, __cmd_free, Show the memory usage in the system.);
#endif
#endif

View File

@ -54,6 +54,7 @@ long int atol(const char* s)
return sign?-v:v;
}
#ifdef RT_USING_HEAP
void *malloc(size_t size)
{
return rt_malloc(size);
@ -73,5 +74,6 @@ void *calloc(size_t nelem, size_t elsize)
{
return rt_calloc(nelem, elsize);
}
#endif
#endif

View File

@ -293,7 +293,7 @@ RTM_EXPORT(rt_timer_delete);
*/
rt_err_t rt_timer_start(rt_timer_t timer)
{
int row_lvl;
unsigned int row_lvl;
rt_list_t *timer_list;
register rt_base_t level;
rt_list_t *row_head[RT_TIMER_SKIP_LIST_LEVEL];