aboutsummaryrefslogtreecommitdiff
path: root/lib/message-file.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2014-12-26 18:34:49 +0100
committerDavid Bremner <david@tethera.net>2015-03-29 00:34:15 +0100
commit9d192da683b0656e37fc8d69c69698ca605926b3 (patch)
tree83434ee169901d44821ce11e406d6363cfe1afc8 /lib/message-file.c
parent736ac26407914425a9c94e86616225292cf716dd (diff)
lib: eliminate fprintf from _notmuch_message_file_open
You may wonder why _notmuch_message_file_open_ctx has two parameters. This is because we need sometime to use a ctx which is a notmuch_message_t. While we could get the database from this, there is no easy way in C to tell type we are getting.
Diffstat (limited to 'lib/message-file.c')
-rw-r--r--lib/message-file.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/message-file.c b/lib/message-file.c
index a41d9ad2..8ac96e8e 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -76,7 +76,8 @@ _notmuch_message_file_destructor (notmuch_message_file_t *message)
/* Create a new notmuch_message_file_t for 'filename' with 'ctx' as
* the talloc owner. */
notmuch_message_file_t *
-_notmuch_message_file_open_ctx (void *ctx, const char *filename)
+_notmuch_message_file_open_ctx (notmuch_database_t *notmuch,
+ void *ctx, const char *filename)
{
notmuch_message_file_t *message;
@@ -98,16 +99,18 @@ _notmuch_message_file_open_ctx (void *ctx, const char *filename)
return message;
FAIL:
- fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno));
+ _notmuch_database_log (notmuch, "Error opening %s: %s\n",
+ filename, strerror (errno));
_notmuch_message_file_close (message);
return NULL;
}
notmuch_message_file_t *
-_notmuch_message_file_open (const char *filename)
+_notmuch_message_file_open (notmuch_database_t *notmuch,
+ const char *filename)
{
- return _notmuch_message_file_open_ctx (NULL, filename);
+ return _notmuch_message_file_open_ctx (notmuch, NULL, filename);
}
void