`while(log->tail != log->head)` more clear, and you can get rid of the next 4 lines.