Xapian::TermIterator iterator_end;
};
+/* We end up having to call the destructor explicitly because we had
+ * to use "placement new" in order to initialize C++ objects within a
+ * block that we allocated with talloc. So C++ is making talloc
+ * slightly less simple to use, (we wouldn't need
+ * talloc_set_destructor at all otherwise).
+ */
static int
-_notmuch_message_destroy (notmuch_message_t *message)
+_notmuch_message_destructor (notmuch_message_t *message)
{
message->doc.~Document ();
new (&message->doc) Xapian::Document;
- talloc_set_destructor (message, _notmuch_message_destroy);
+ talloc_set_destructor (message, _notmuch_message_destructor);
message->doc = notmuch->xapian_db->get_document (doc_id);
return NULL;
}
+/* We end up having to call the destructors explicitly because we had
+ * to use "placement new" in order to initialize C++ objects within a
+ * block that we allocated with talloc. So C++ is making talloc
+ * slightly less simple to use, (we wouldn't need
+ * talloc_set_destructor at all otherwise).
+ */
static int
-_notmuch_tags_destroy (notmuch_tags_t *tags)
+_notmuch_tags_destructor (notmuch_tags_t *tags)
{
tags->iterator.~TermIterator ();
tags->iterator_end.~TermIterator ();
new (&tags->iterator) Xapian::TermIterator;
new (&tags->iterator_end) Xapian::TermIterator;
- talloc_set_destructor (tags, _notmuch_tags_destroy);
+ talloc_set_destructor (tags, _notmuch_tags_destructor);
tags->iterator = message->doc.termlist_begin ();
tags->iterator.skip_to ("L");
return tags;
}
+void
+notmuch_message_destroy (notmuch_message_t *message)
+{
+ talloc_free (message);
+}
+
notmuch_bool_t
notmuch_tags_has_more (notmuch_tags_t *tags)
{
{
tags->iterator++;
}
+
+void
+notmuch_tags_destroy (notmuch_tags_t *tags)
+{
+ talloc_free (tags);
+}