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");
query->sort = sort;
}
+/* 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_results_destroy (notmuch_results_t *results)
+_notmuch_results_destructor (notmuch_results_t *results)
{
results->iterator.~PostingIterator ();
results->iterator_end.~PostingIterator ();
new (&results->iterator) Xapian::PostingIterator ();
new (&results->iterator_end) Xapian::PostingIterator ();
- talloc_set_destructor (results, _notmuch_results_destroy);
+ talloc_set_destructor (results, _notmuch_results_destructor);
results->iterator = query->notmuch->xapian_db->postlist_begin ("");
results->iterator_end = query->notmuch->xapian_db->postlist_end ("");