diff options
author | Guillem Jover <guillem@debian.org> | 2016-10-10 05:36:30 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2016-10-30 06:29:50 +0100 |
commit | bb4ae26e35f9ca76a991ace7fb3497823ac1a3e8 (patch) | |
tree | 8c3dc89f73315dcf294ad724e0bcb865c20f01d6 /lib | |
parent | 678fd0b6dc195f48779fda72b0eb97d68c85e7ac (diff) | |
download | dpkg-bb4ae26e35f9ca76a991ace7fb3497823ac1a3e8.tar.gz |
libdpkg: Simplify and trim-down dlist.h macros
Remove unused macros and simplify remaining ones given the current usage
in the code base.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dpkg/dlist.h | 39 | ||||
-rw-r--r-- | lib/dpkg/triglib.c | 6 | ||||
-rw-r--r-- | lib/dpkg/trignote.c | 2 |
3 files changed, 20 insertions, 27 deletions
diff --git a/lib/dpkg/dlist.h b/lib/dpkg/dlist.h index feffe8c86..1d3a91edb 100644 --- a/lib/dpkg/dlist.h +++ b/lib/dpkg/dlist.h @@ -17,36 +17,29 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#ifndef ADNS_DLIST_H_INCLUDED -#define ADNS_DLIST_H_INCLUDED +#ifndef DPKG_DLIST_H +#define DPKG_DLIST_H -#define LIST_INIT(list) ((list).head = (list).tail = NULL) -#define LINK_INIT(link) ((link).next = (link).prev = NULL) - -#define LIST_UNLINK_PART(list, node, part) \ - do { \ - if ((node)->part prev) \ - (node)->part prev->part next = (node)->part next; \ - else \ - (list).head = (node)->part next; \ - if ((node)->part next) \ - (node)->part next->part prev = (node)->part prev; \ - else \ - (list).tail = (node)->part prev; \ +#define LIST_UNLINK_PART(list, node, part) \ + do { \ + if ((node)->part.prev) \ + (node)->part.prev->part.next = (node)->part.next; \ + else \ + (list).head = (node)->part.next; \ + if ((node)->part.next) \ + (node)->part.next->part.prev = (node)->part.prev; \ + else \ + (list).tail = (node)->part.prev; \ } while (0) #define LIST_LINK_TAIL_PART(list, node, part) \ do { \ - (node)->part next = NULL; \ - (node)->part prev = (list).tail; \ - if ((list).tail) \ - (list).tail->part next = (node); \ + (node)->part.next = NULL; \ + (node)->part.prev = (list).tail; \ + if ((list).tail) \ + (list).tail->part.next = (node); \ else (list).head = (node); \ (list).tail = (node); \ } while (0) - -#define LIST_UNLINK(list, node) LIST_UNLINK_PART(list, node,) -#define LIST_LINK_TAIL(list, node) LIST_LINK_TAIL_PART(list, node,) - #endif diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c index 7ee5d31c8..57bd2a66b 100644 --- a/lib/dpkg/triglib.c +++ b/lib/dpkg/triglib.c @@ -112,7 +112,7 @@ trig_clear_awaiters(struct pkginfo *notpend) aw = ta->aw; if (!aw) continue; - LIST_UNLINK_PART(aw->trigaw, ta, sameaw.); + LIST_UNLINK_PART(aw->trigaw, ta, sameaw); if (!aw->trigaw.head && aw->status == PKG_STAT_TRIGGERSAWAITED) { if (aw->trigpend_head) pkg_set_status(aw, PKG_STAT_TRIGGERSPENDING); @@ -422,7 +422,7 @@ trk_file_interest_change(const char *trig, struct pkginfo *pkg, tfi->samefile_next = *trigh.namenode_interested(fnn); *trigh.namenode_interested(fnn) = tfi; - LIST_LINK_TAIL_PART(filetriggers, tfi, inoverall.); + LIST_LINK_TAIL_PART(filetriggers, tfi, inoverall); goto edited; found: @@ -436,7 +436,7 @@ found: /* Remove it: */ *search = tfi->samefile_next; - LIST_UNLINK_PART(filetriggers, tfi, inoverall.); + LIST_UNLINK_PART(filetriggers, tfi, inoverall); edited: filetriggers_edited = 1; } diff --git a/lib/dpkg/trignote.c b/lib/dpkg/trignote.c index b7e154f6a..1029a030e 100644 --- a/lib/dpkg/trignote.c +++ b/lib/dpkg/trignote.c @@ -96,7 +96,7 @@ trig_note_aw(struct pkginfo *pend, struct pkginfo *aw) ta->pend = pend; ta->samepend_next = pend->othertrigaw_head; pend->othertrigaw_head = ta; - LIST_LINK_TAIL_PART(aw->trigaw, ta, sameaw.); + LIST_LINK_TAIL_PART(aw->trigaw, ta, sameaw); return true; } |