if (ret)
return ret;
- message_file = _notmuch_message_file_open (filename);
+ message_file = _notmuch_message_file_open (notmuch, filename);
if (message_file == NULL)
return NOTMUCH_STATUS_FILE_ERROR;
/* 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;
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
if (unlikely (filename == NULL))
return;
- message->message_file = _notmuch_message_file_open_ctx (message, filename);
+ message->message_file = _notmuch_message_file_open_ctx (
+ _notmuch_message_database (message), message, filename);
}
const char *
* Returns NULL if any error occurs.
*/
notmuch_message_file_t *
-_notmuch_message_file_open (const char *filename);
+_notmuch_message_file_open (notmuch_database_t *notmuch, const char *filename);
/* Like notmuch_message_file_open but 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);
/* Close a notmuch message previously opened with notmuch_message_open. */
void