Re: Strange coding in mvdistinct.c

2019-04-21 Thread Tomas Vondra
On Mon, Apr 15, 2019 at 06:12:24PM -0400, Tom Lane wrote: Oh, and as I continue to grep, I found this in dependencies.c: dependencies = (MVDependencies *) repalloc(dependencies, offsetof(MVDependencies, deps)

Re: Strange coding in mvdistinct.c

2019-04-15 Thread Tomas Vondra
On Mon, Apr 15, 2019 at 06:12:24PM -0400, Tom Lane wrote: Oh, and as I continue to grep, I found this in dependencies.c: dependencies = (MVDependencies *) repalloc(dependencies, offsetof(MVDependencies, deps)

Re: Strange coding in mvdistinct.c

2019-04-15 Thread Tom Lane
Oh, and as I continue to grep, I found this in dependencies.c: dependencies = (MVDependencies *) repalloc(dependencies, offsetof(MVDependencies, deps) + dependencies->ndeps *

Strange coding in mvdistinct.c

2019-04-15 Thread Tom Lane
In the wake of the discussion at [1] I went looking for structs that should be using FLEXIBLE_ARRAY_MEMBER and are not, by dint of grepping for size calculations of the form "offsetof(struct,fld) + n * sizeof(...)" and then seeing how "fld" is declared. I haven't yet found anything like that that