From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 2C6306DE1E2B for ; Sat, 18 Feb 2017 06:46:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=0.006, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MCprzy-lYvi1 for ; Sat, 18 Feb 2017 06:46:39 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 8427E6DE1E1A for ; Sat, 18 Feb 2017 06:46:39 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1cf6Gw-0004Z3-D0; Sat, 18 Feb 2017 09:46:02 -0500 Received: (nullmailer pid 23026 invoked by uid 1000); Sat, 18 Feb 2017 14:46:33 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 4/8] lib: push error from nme_metadata through nme_filename_list Date: Sat, 18 Feb 2017 10:45:47 -0400 Message-Id: <20170218144551.22925-5-david@tethera.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170218144551.22925-1-david@tethera.net> References: <20170218144551.22925-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2017 14:46:40 -0000 The NULL returns documented here are not actually API changing, they were just previously undocumented. --- lib/message.cc | 20 +++++++++++++------- lib/notmuch.h | 4 ++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 16ea980c..f55dd9fa 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -843,16 +843,19 @@ _notmuch_message_clear_data (notmuch_message_t *message) message->modified = TRUE; } -static void +static notmuch_private_status_t _notmuch_message_ensure_filename_list (notmuch_message_t *message) { notmuch_string_node_t *node; if (message->filename_list) - return; + return NOTMUCH_PRIVATE_STATUS_SUCCESS; - if (!message->filename_term_list) - _notmuch_message_ensure_metadata (message); + if (!message->filename_term_list) { + notmuch_private_status_t status = _notmuch_message_ensure_metadata (message); + if (status) + return status; + } message->filename_list = _notmuch_string_list_create (message); node = message->filename_term_list->head; @@ -873,7 +876,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message) _notmuch_string_list_append (message->filename_list, data); - return; + return NOTMUCH_PRIVATE_STATUS_SUCCESS; } for (; node; node = node->next) { @@ -913,12 +916,14 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message) talloc_free (message->filename_term_list); message->filename_term_list = NULL; + return NOTMUCH_PRIVATE_STATUS_SUCCESS; } const char * notmuch_message_get_filename (notmuch_message_t *message) { - _notmuch_message_ensure_filename_list (message); + if (_notmuch_message_ensure_filename_list (message)) + return NULL; if (message->filename_list == NULL) return NULL; @@ -935,7 +940,8 @@ notmuch_message_get_filename (notmuch_message_t *message) notmuch_filenames_t * notmuch_message_get_filenames (notmuch_message_t *message) { - _notmuch_message_ensure_filename_list (message); + if (_notmuch_message_ensure_filename_list (message)) + return NULL; return _notmuch_filenames_create (message, message->filename_list); } diff --git a/lib/notmuch.h b/lib/notmuch.h index 62866e5a..4e25958c 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -1341,6 +1341,8 @@ notmuch_message_get_replies (notmuch_message_t *message); * this function will arbitrarily return a single one of those * filenames. See notmuch_message_get_filenames for returning the * complete list of filenames. + * + * The function returns NULL on error. */ const char * notmuch_message_get_filename (notmuch_message_t *message); @@ -1354,6 +1356,8 @@ notmuch_message_get_filename (notmuch_message_t *message); * * Each filename in the iterator is an absolute filename, (the initial * component will match notmuch_database_get_path() ). + * + * The function returns NULL on error. */ notmuch_filenames_t * notmuch_message_get_filenames (notmuch_message_t *message); -- 2.11.0