Simplify TAILQ usage and avoid additional memory allocations.

Tested by:	Eugene M. Zheganin <emz norma.perm.ru>
Sponsored by:	Nginx, Inc