X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=database.cc;h=e73e210d1071658609f31fbceacbce0b35a13e4e;hp=1aef2a966ec3fb431ff3b6f92735f0fdb57f4326;hb=17b3c214ea123a0e03c5bfff8fc3826976f5ad64;hpb=d29a6ec79167e87e4958d9500956668c430db4c6 diff --git a/database.cc b/database.cc index 1aef2a96..e73e210d 100644 --- a/database.cc +++ b/database.cc @@ -456,10 +456,8 @@ notmuch_database_open (const char *path) xapian_path = g_strdup_printf ("%s/%s", notmuch_path, "xapian"); - /* C++ is so nasty in requiring these casts. I'm almost tempted to - * write a C wrapper for Xapian... */ - notmuch = (notmuch_database_t *) xmalloc (sizeof (notmuch_database_t)); - notmuch->path = xstrdup (path); + notmuch = talloc (NULL, notmuch_database_t); + notmuch->path = talloc_strdup (notmuch, path); try { 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->xapian_db; - free (notmuch->path); - free (notmuch); + talloc_free (notmuch); } const char *