[PATCH 3/6] lib: Eliminate _notmuch_message_list_append

Austin Clements amdragon at MIT.EDU
Sat Nov 24 20:57:04 PST 2012


This API invited micro-optimized and complicated list pointer
manipulation and is no longer used.
---
 lib/messages.c        |   17 +++--------------
 lib/notmuch-private.h |    4 ----
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/lib/messages.c b/lib/messages.c
index 1121864..0eee569 100644
--- a/lib/messages.c
+++ b/lib/messages.c
@@ -42,19 +42,7 @@ _notmuch_message_list_create (const void *ctx)
     return list;
 }
 
-/* Append a single 'node' to the end of 'list'.
- */
-void
-_notmuch_message_list_append (notmuch_message_list_t *list,
-			      notmuch_message_node_t *node)
-{
-    *(list->tail) = node;
-    list->tail = &node->next;
-}
-
-/* Allocate a new node for 'message' and append it to the end of
- * 'list'.
- */
+/* Append 'message' to the end of 'list'. */
 void
 _notmuch_message_list_add_message (notmuch_message_list_t *list,
 				   notmuch_message_t *message)
@@ -64,7 +52,8 @@ _notmuch_message_list_add_message (notmuch_message_list_t *list,
     node->message = message;
     node->next = NULL;
 
-    _notmuch_message_list_append (list, node);
+    *(list->tail) = node;
+    list->tail = &node->next;
 }
 
 notmuch_messages_t *
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index c054a0e..f38ccb3 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -429,10 +429,6 @@ notmuch_message_list_t *
 _notmuch_message_list_create (const void *ctx);
 
 void
-_notmuch_message_list_append (notmuch_message_list_t *list,
-			      notmuch_message_node_t *node);
-
-void
 _notmuch_message_list_add_message (notmuch_message_list_t *list,
 				   notmuch_message_t *message);
 
-- 
1.7.10.4



More information about the notmuch mailing list