• Tom Lane's avatar
    Minor additional improvements for ecpglib/prepare.c. · d8cc1616
    Tom Lane authored
    Avoid allocating never-used entries in stmtCacheEntries[], other than the
    intentionally-unused zero'th entry.  Tie the array size directly to the
    bucket count and size, rather than having undocumented dependencies between
    three magic constants.  Fix the hash calculation to be platform-independent
    --- notably, it was sensitive to the signed'ness of "char" before, not to
    mention having an unnecessary hard-wired dependency on the existence and
    size of type "long long".  (The lack of complaints says it's been a long
    time since anybody tried to build PG on a compiler without "long long",
    and certainly with the requirement for C99 this isn't a live bug anymore.
    But it's still not per project coding style.)  Fix ecpg_auto_prepare's
    new-cache-entry path so that it increments the exec count for the new
    cache entry not the dummy zero'th entry.
    
    The last of those is an actual bug, though one of little consequence;
    the rest is mostly future-proofing and neatnik-ism.  Doesn't seem
    necessary to back-patch.
    d8cc1616
preproc-autoprep.stderr 18.2 KB