[PATCH] lib/database.cc: fix misleading indentation

Franz Fellner alpine.art.de at gmail.com
Thu Oct 20 23:42:37 PDT 2016


On Thu, 20 Oct 2016 20:45:00 -0300, David Bremner <david at tethera.net> wrote:
> Franz Fellner <alpine.art.de at gmail.com> writes:
> 
> > From a quick visual scan at least half the indented lines start with 4 spaces
> > instead of TABS. As I understand the quoted paragraph that should be wrong.
> >
> 
> Can you be specific what what lines in what file? I have the feeling
> you're misinterpreting something, or looking at a different file.

This is from lib/database.cc:

const char *
_find_prefix (const char *name)
{
    unsigned int i;

    for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX_INTERNAL); i++) {
	if (strcmp (name, BOOLEAN_PREFIX_INTERNAL[i].name) == 0)
	    return BOOLEAN_PREFIX_INTERNAL[i].prefix;
    }

    for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX_EXTERNAL); i++) {
	if (strcmp (name, BOOLEAN_PREFIX_EXTERNAL[i].name) == 0)
	    return BOOLEAN_PREFIX_EXTERNAL[i].prefix;
    }

    for (i = 0; i < ARRAY_SIZE (PROBABILISTIC_PREFIX); i++) {
	if (strcmp (name, PROBABILISTIC_PREFIX[i].name) == 0)
	    return PROBABILISTIC_PREFIX[i].prefix;
    }

    INTERNAL_ERROR ("No prefix exists for '%s'\n", name);

    return "";
}

I set ":set list" and ":set listchars=tab:>-" to visualize tabs in vim. This shows me
* the first two codelines (leaving out empty lines) are indented by 4 spaces
* the first line in the first for loop is indented by only one TAB (IMHO should be
  two, because it is one leven down): this is a pattern you can find throughout the
  codebase.
* the next two lines are indented by four spaces
* the first line of the second for-loop is indented by one TAB.
* and so on...

Am I misinterpreting something here? Is this intended to be done that way?
I also get confused by the different lengths of TAB/space-indenting. But probably
that's because I never used it...


More information about the notmuch mailing list