mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-22 19:37:24 +08:00
Merge pull request #169 from grissiom/log_trace-fix
log_trace: fix the memmove use
This commit is contained in:
commit
1c16c5851e
@ -93,6 +93,9 @@ static struct log_trace_session* _lg_lookup_session(log_trace_idnum_t num)
|
|||||||
last = _the_sess_nr;
|
last = _the_sess_nr;
|
||||||
do {
|
do {
|
||||||
unsigned int i = (first + last)/2;
|
unsigned int i = (first + last)/2;
|
||||||
|
|
||||||
|
RT_ASSERT(_the_sessions[i]);
|
||||||
|
|
||||||
if (_the_sessions[i]->id.num == num)
|
if (_the_sessions[i]->id.num == num)
|
||||||
{
|
{
|
||||||
/* there is no need to protect the _cache because write a pointer
|
/* there is no need to protect the _cache because write a pointer
|
||||||
@ -135,7 +138,8 @@ rt_err_t log_trace_register_session(struct log_trace_session *session)
|
|||||||
{
|
{
|
||||||
if (_the_sessions[i]->id.num > session->id.num)
|
if (_the_sessions[i]->id.num > session->id.num)
|
||||||
{
|
{
|
||||||
rt_memmove(_the_sessions+i, _the_sessions+i+1, _the_sess_nr-i);
|
rt_memmove(_the_sessions+i+1, _the_sessions+i,
|
||||||
|
(_the_sess_nr-i)*sizeof(&_the_sessions[0]));
|
||||||
_the_sessions[i] = session;
|
_the_sessions[i] = session;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user