diff options
author | Carl Worth <cworth@cworth.org> | 2009-10-21 14:00:37 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-10-21 14:00:37 -0700 |
commit | 17b3c214ea123a0e03c5bfff8fc3826976f5ad64 (patch) | |
tree | a042b29fcfdf8594f8172c7a8a23e954d4556261 /database.cc | |
parent | 9ec5189a56e5616792f0a8a2ee6fba4e397ae2e2 (diff) |
Convert notmuch_database_t to start using talloc.
This will be handy as we can hang future talloc allocations off
of the datbase now.
Diffstat (limited to 'database.cc')
-rw-r--r-- | database.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/database.cc b/database.cc index 1aef2a9..e73e210 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 * |