[notmuch] _notmuch_message_create_for_message_id makes extra call to notmuch_database_find_message

2009-11-27 Thread Keith Packard
On Fri, 27 Nov 2009 04:46:54 -0800, Carl Worth  wrote:

> Did the "if" statement immediately afterwards just look like error
> checking? It's not:

Yes, it did (I think my brain may have auto-inserted a '!' there).

Ok, having read the code a bit more carefully, this does look correct.

I have to say that _notmuch_message_create is a bit of a tricky name; as
it doesn't create a message so much as load a message from the database.

-- 
keith.packard at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[notmuch] _notmuch_message_create_for_message_id makes extra call to notmuch_database_find_message

2009-11-27 Thread Carl Worth
On Mon, 23 Nov 2009 12:29:44 -0800, Keith Packard  wrote:
> 
> Looking at _notmuch_message_create_for_message_id, the first thing it
> does is call notmuch_database_find_message, but the returned 'message'
> is never used. I haven't tried, but I suspect this call could just be
> removed.

Did the "if" statement immediately afterwards just look like error
checking? It's not:

message = notmuch_database_find_message (notmuch, message_id);
if (message)
return talloc_steal (notmuch, message);

That's "if there's a message is in the database with this message-id,
return it straight away".

Or am I looking at the wrong bit of code?

-Carl


Re: [notmuch] _notmuch_message_create_for_message_id makes extra call to notmuch_database_find_message

2009-11-27 Thread Carl Worth
On Mon, 23 Nov 2009 12:29:44 -0800, Keith Packard kei...@keithp.com wrote:
 
 Looking at _notmuch_message_create_for_message_id, the first thing it
 does is call notmuch_database_find_message, but the returned 'message'
 is never used. I haven't tried, but I suspect this call could just be
 removed.

Did the if statement immediately afterwards just look like error
checking? It's not:

message = notmuch_database_find_message (notmuch, message_id);
if (message)
return talloc_steal (notmuch, message);

That's if there's a message is in the database with this message-id,
return it straight away.

Or am I looking at the wrong bit of code?

-Carl
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] _notmuch_message_create_for_message_id makes extra call to notmuch_database_find_message

2009-11-27 Thread Keith Packard
On Fri, 27 Nov 2009 04:46:54 -0800, Carl Worth cwo...@cworth.org wrote:

 Did the if statement immediately afterwards just look like error
 checking? It's not:

Yes, it did (I think my brain may have auto-inserted a '!' there).

Ok, having read the code a bit more carefully, this does look correct.

I have to say that _notmuch_message_create is a bit of a tricky name; as
it doesn't create a message so much as load a message from the database.

-- 
keith.pack...@intel.com


pgpWLQZVLvA3C.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] _notmuch_message_create_for_message_id makes extra call to notmuch_database_find_message

2009-11-23 Thread Keith Packard

Looking at _notmuch_message_create_for_message_id, the first thing it
does is call notmuch_database_find_message, but the returned 'message'
is never used. I haven't tried, but I suspect this call could just be
removed.

-- 
keith.packard at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: