[PATCH 2/5] go: Update for changes to notmuch_database_get_directory

Austin Clements amdragon at MIT.EDU
Sun May 13 12:57:06 PDT 2012


---
 bindings/go/src/notmuch/notmuch.go  |   13 +++++++------
 bindings/python/notmuch/database.py |    4 ++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go
index 12de4c8..00bd53a 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -191,19 +191,20 @@ func (self *Database) NeedsUpgrade() bool {
  *
  * Can return NULL if a Xapian exception occurs.
  */
-func (self *Database) GetDirectory(path string) *Directory {
+func (self *Database) GetDirectory(path string) (*Directory, Status) {
 	var c_path *C.char = C.CString(path)
 	defer C.free(unsafe.Pointer(c_path))
 
 	if c_path == nil {
-		return nil
+		return nil, STATUS_OUT_OF_MEMORY
 	}
 
-	c_dir := C.notmuch_database_get_directory(self.db, c_path)
-	if c_dir == nil {
-		return nil
+	var c_dir *C.notmuch_directory_t
+	st := Status(C.notmuch_database_get_directory(self.db, c_path, &c_dir))
+	if st != STATUS_SUCCESS || c_dir == nil {
+		return nil, st
 	}
-	return &Directory{dir: c_dir}
+	return &Directory{dir: c_dir}, st
 }
 
 /* Add a new message to the given notmuch database.
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 1b1ddc3..0a58dd0 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -73,8 +73,8 @@ class Database(object):
 
     """notmuch_database_get_directory"""
     _get_directory = nmlib.notmuch_database_get_directory
-    _get_directory.argtypes = [NotmuchDatabaseP, c_char_p]
-    _get_directory.restype = NotmuchDirectoryP
+    _get_directory.argtypes = [NotmuchDatabaseP, c_char_p, POINTER(NotmuchDirectoryP)]
+    _get_directory.restype = c_uint
 
     """notmuch_database_get_path"""
     _get_path = nmlib.notmuch_database_get_path
-- 
1.7.10



More information about the notmuch mailing list