Re: Concerns regarding some library functions

Subject: Re: Concerns regarding some library functions

Date: Wed, 28 Sep 2011 17:42:01 +0200

To: Ali Polatel, notmuch@notmuchmail.org

Cc:

From: Sebastian Spaeth


On Tue, 27 Sep 2011 16:25:58 +0300, Ali Polatel wrote:
> The two functions I've mentioned above are
> notmuch_database_find_message() and
> notmuch_database_find_message_by_filename().
> 
> The problem with their design is NULL return may both mean an error
> condition and "message not found". However, we already have a similar
> function which does not have such a flaw, namely notmuch_database_add_message().

Yes, this is because NULL used to mean message not found and NULL means
error was tacked on later (because cworth did not expect that xapian
would actually throw errors that often (such as database modified and
whatnot). So the meaning of NULL is, ahhem, suboptimal...

ERROR or really not there? There are mails from me, commenting on
that. I would welcome receiving back a notmuch_status_t value and have a
separate notmuch_message_t parameter which receives the actual message.

Sebastian
part-000.sig (application/pgp-signature)

Thread: