]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
queue: mod to TAILQ_MOVE to ensure empty Q is properly copied/init
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 4 Apr 2014 08:52:16 +0000 (09:52 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Fri, 4 Apr 2014 08:55:07 +0000 (09:55 +0100)
This mirrors a change that Andreas had already made in the showtime copy.

src/queue.h

index bf5a4de0679665573f9cfebdee10e66bcb6c7557..889fdca5bebcaafe381a250571dbb660bac06944 100644 (file)
 #define TAILQ_MOVE(newhead, oldhead, field) do { \
         if(TAILQ_FIRST(oldhead)) { \
            TAILQ_FIRST(oldhead)->field.tqe_prev = &(newhead)->tqh_first;  \
-        } \
-        (newhead)->tqh_first = (oldhead)->tqh_first;                   \
-        (newhead)->tqh_last = (oldhead)->tqh_last;                     \
+          (newhead)->tqh_first = (oldhead)->tqh_first;                   \
+          (newhead)->tqh_last = (oldhead)->tqh_last;                     \
+          TAILQ_INIT(oldhead);\
+        } else { \
+          TAILQ_INIT(newhead);\
+        }\
 } while (/*CONSTCOND*/0)