mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-03 15:21:41 +01:00
Convert notmuch_database_t to start using talloc.
This will be handy as we can hang future talloc allocations off of the datbase now.
This commit is contained in:
parent
9ec5189a56
commit
17b3c214ea
1 changed files with 3 additions and 6 deletions
|
@ -456,10 +456,8 @@ notmuch_database_open (const char *path)
|
||||||
|
|
||||||
xapian_path = g_strdup_printf ("%s/%s", notmuch_path, "xapian");
|
xapian_path = g_strdup_printf ("%s/%s", notmuch_path, "xapian");
|
||||||
|
|
||||||
/* C++ is so nasty in requiring these casts. I'm almost tempted to
|
notmuch = talloc (NULL, notmuch_database_t);
|
||||||
* write a C wrapper for Xapian... */
|
notmuch->path = talloc_strdup (notmuch, path);
|
||||||
notmuch = (notmuch_database_t *) xmalloc (sizeof (notmuch_database_t));
|
|
||||||
notmuch->path = xstrdup (path);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path,
|
notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path,
|
||||||
|
@ -488,8 +486,7 @@ notmuch_database_close (notmuch_database_t *notmuch)
|
||||||
{
|
{
|
||||||
delete notmuch->query_parser;
|
delete notmuch->query_parser;
|
||||||
delete notmuch->xapian_db;
|
delete notmuch->xapian_db;
|
||||||
free (notmuch->path);
|
talloc_free (notmuch);
|
||||||
free (notmuch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
Loading…
Reference in a new issue