test-list.c revision 3ad85e3775d018f32098a2957ce25e1f53440da1
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen This file is part of systemd
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen Copyright 2013 Jan Janssen
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen systemd is free software; you can redistribute it and/or modify it
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen under the terms of the GNU Lesser General Public License as published by
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen the Free Software Foundation; either version 2.1 of the License, or
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen (at your option) any later version.
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen systemd is distributed in the hope that it will be useful, but
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen WITHOUT ANY WARRANTY; without even the implied warranty of
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen Lesser General Public License for more details.
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen You should have received a copy of the GNU Lesser General Public License
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen along with systemd; If not, see <http://www.gnu.org/licenses/>.
3b18ae6866043ac4d96ee9bcada1a42469c80129Jan Janssen typedef struct list_item {
7663df377016cf7b95001aec893006647175ae4aLennart Poettering LIST_FOREACH_OTHERS(item, cursor, &items[2]) {
3ad85e3775d018f32098a2957ce25e1f53440da1Lennart Poettering LIST_FOREACH_OTHERS(item, cursor, &items[0]) {
3ad85e3775d018f32098a2957ce25e1f53440da1Lennart Poettering LIST_FOREACH_OTHERS(item, cursor, &items[3]) {
71fda00f320379f5cbee8e118848de98caaa229dLennart Poettering LIST_INSERT_AFTER(item, head, &items[3], &items[1]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek for (i = 0; i < ELEMENTSOF(items); i++) {
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(LIST_JUST_US(item, &items[i]));
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek LIST_APPEND(item, head, &items[i]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(!LIST_JUST_US(item, head));
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[0].item_next == &items[1]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[1].item_next == &items[2]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[2].item_next == &items[3]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[3].item_next == NULL);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[0].item_prev == NULL);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[1].item_prev == &items[0]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[2].item_prev == &items[1]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek assert_se(items[3].item_prev == &items[2]);
502f1733e320b1339beafa949a41db3027c46ec6Zbigniew Jędrzejewski-Szmek for (i = 0; i < ELEMENTSOF(items); i++)