From: | Volkan YAZICI <yazicivo(at)ttnet(dot)net(dot)tr> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: intarray internals |
Date: | 2006-05-06 09:38:25 |
Message-ID: | 20060506093825.GA202@alamut |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2006-05-06 10:13:03 | Re: intarray internals |
Previous Message | chris smith | 2006-05-06 05:36:08 | Re: Catch individual exceptions |
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2006-05-06 10:13:03 | Re: intarray internals |
Previous Message | Martijn van Oosterhout | 2006-05-06 09:03:53 | Re: InsertXLogFile in pg_resetxlog |