unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Piotr Trojanek <piotr.trojanek@gmail.com>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 4/5] fix wrong printf formatting of signed/unsigned integers
Date: Mon, 26 Jun 2017 13:14:37 +0100	[thread overview]
Message-ID: <CAGExNxEJOYsdbtEJ8-OhdU6-61HH9qykSToSrjtrco8jYqkxbw@mail.gmail.com> (raw)
In-Reply-To: <87fuetiamo.fsf@fifthhorseman.net>

On Wed, Jun 21, 2017 at 5:11 PM, Daniel Kahn Gillmor
<dkg@fifthhorseman.net> wrote:
> patch 5 adds FIXMEs that should probably actually be fixed, though, rather than just flagged.

Thanks for merging the uncontroversial patches. Fixing the flagged
problems is not obvious to me, it really depends on your intentions.

For the first FIXME, the documentation for notmuch_directory_delete
says (lib/notmuch.h:1971):

 * Delete directory document from the database, and destroy the
 * notmuch_directory_t object.

but that is not what happens, for example, if the call to
_notmuch_database_ensure_writable fails. Then the notmuch_directory_t
object is only destroyed by the caller (see the end of
_remove_directory function, notmuch-new.c:886).

The comment should clearly say if the object is always destroyed or
only if no error happened.

For the second FIXME, I don't quite see why not just use the bsearch
function. It could be called either with strcmp (if exact is true) or
with a simple wrapper around strncmp (if exact is false). This wrapper
could replace the string_cmp routine, so together with bsearch this
could even make the code smaller.

Also, I don't really understand the intention behind declaring
string_cmp as returning notmuch_bool_t and then, in bsearch_first,
casting its result to int.

Am I missing something?

-- 
Piotr Trojanek

  reply	other threads:[~2017-06-26 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 22:50 [PATCH 1/5] minor whitespace cleanups Piotr Trojanek
2017-06-16 22:50 ` [PATCH 2/5] add leaks due to missing invocations of va_end Piotr Trojanek
2017-06-16 22:50 ` [PATCH 3/5] remove ineffective assignments Piotr Trojanek
2017-08-20 13:56   ` Jani Nikula
2017-06-16 22:50 ` [PATCH 4/5] fix wrong printf formatting of signed/unsigned integers Piotr Trojanek
2017-06-21 16:11   ` Daniel Kahn Gillmor
2017-06-26 12:14     ` Piotr Trojanek [this message]
2017-06-26 13:04       ` David Bremner
2017-06-26 22:54       ` David Bremner
2017-06-25 12:57   ` David Bremner
2017-06-16 22:50 ` [PATCH 5/5] flag potential problems with FIXME Piotr Trojanek
2017-06-25 12:34 ` [PATCH 1/5] minor whitespace cleanups David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGExNxEJOYsdbtEJ8-OhdU6-61HH9qykSToSrjtrco8jYqkxbw@mail.gmail.com \
    --to=piotr.trojanek@gmail.com \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).