Oops. Put back some changes to go only with others.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29289 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-02-12 12:33:43 +00:00
parent 3c81bf0c13
commit 50c727ce7a

View file

@ -450,6 +450,9 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
return false; return false;
} }
mutex_lock(&llist_mutex);
mutex_lock(&llist_mod_mutex);
oldpos = ringbuf_offset(src); oldpos = ringbuf_offset(src);
newpos = ringbuf_add(oldpos, final_delta); newpos = ringbuf_add(oldpos, final_delta);
overlap = ringbuf_add_cross(newpos, size_to_move, buffer_len); overlap = ringbuf_add_cross(newpos, size_to_move, buffer_len);
@ -475,6 +478,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
correction = (correction + 3) & ~3; correction = (correction + 3) & ~3;
if (final_delta < correction + sizeof(struct memory_handle)) { if (final_delta < correction + sizeof(struct memory_handle)) {
/* Delta cannot end up less than the size of the struct */ /* Delta cannot end up less than the size of the struct */
mutex_unlock(&llist_mod_mutex);
mutex_unlock(&llist_mutex);
return false; return false;
} }
newpos -= correction; newpos -= correction;
@ -496,6 +501,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
if (m && m->next == src) { if (m && m->next == src) {
m->next = dest; m->next = dest;
} else { } else {
mutex_unlock(&llist_mod_mutex);
mutex_unlock(&llist_mutex);
return false; return false;
} }
} }
@ -556,6 +563,8 @@ static bool move_handle(struct memory_handle **h, size_t *delta,
/* Update the caller with the new location of h and the distance moved */ /* Update the caller with the new location of h and the distance moved */
*h = dest; *h = dest;
*delta = final_delta; *delta = final_delta;
mutex_unlock(&llist_mod_mutex);
mutex_unlock(&llist_mutex);
return true; return true;
} }