From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: pgsql-general@postgresql.org
Subject: Re: intarray internals
Date: Sat, 6 May 2006 12:38:25 +0300
Message-ID: <20060506093825.GA202@alamut> (raw)
In-Reply-To: <20060505214601.GA208@alamut>
References: <20060505214601.GA208@alamut>
On May 06 12:46, Volkan YAZICI wrote:
> I'm reading through the source code of intarray contrib module. Despite
> being at the beginning, I've some questions to ask. I'd be so
> appreciated if anybody can help.
Sorry, I forgot one:
[4]
In the inner_int_contains() function of _int_tool.c, there's a while
loop like
[Code assumes that arrays are sorted.]
na = ARRNELEMS(a);
nb = ARRNELEMS(b);
da = ARRPTR(a);
db = ARRPTR(b);
i = j = n = 0;
while (i < na && j < nb)
if (da[i] < db[j])
i++;
else if (da[i] == db[j])
{
n++;
i++;
j++;
}
else
j++;
return (n == nb) ? TRUE : FALSE;
AFAICS, last "j++" should be replaced with "return FALSE". Because, "n"
cannot be equal to "nb" no more, if "j" gets incremented without
incrementing "n" (remember "j < nb" in the "while" condition).
Regards.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: yazicivo@ttnet.net.tr, pgsql-general@postgresql.org
Subject: Re: intarray internals
In-Reply-To: <20060506093825.GA202@alamut>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox