[dpkg] 122/187: libdpkg: Simplify and trim-down dlist.h macros

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository dpkg.

commit bb4ae26e35f9ca76a991ace7fb3497823ac1a3e8
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Oct 10 05:36:30 2016 +0200

    libdpkg: Simplify and trim-down dlist.h macros
    
    Remove unused macros and simplify remaining ones given the current usage
    in the code base.
---
 lib/dpkg/dlist.h    | 39 ++++++++++++++++-----------------------
 lib/dpkg/triglib.c  |  6 +++---
 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 feffe8c..1d3a91e 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 7ee5d31..57bd2a6 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 b7e154f..1029a03 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;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list