~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/backend/utils/adt/arrayfuncs.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-06-14 09:53:29 UTC
  • mto: (6.1.1 sid) (10.1.1 oneiric-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20110614095329-71gfhjywyp2c27au
Tags: upstream-9.1~beta2
ImportĀ upstreamĀ versionĀ 9.1~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
3533
3533
        int                     ndims = ARR_NDIM(array);
3534
3534
        int                *dims = ARR_DIMS(array);
3535
3535
        Oid                     element_type = ARR_ELEMTYPE(array);
3536
 
        uint32          result = 0;
 
3536
        uint32          result = 1;
3537
3537
        int                     nitems;
3538
3538
        TypeCacheEntry *typentry;
3539
3539
        int                     typlen;
3617
3617
                }
3618
3618
 
3619
3619
                /*
3620
 
                 * Combine hash values of successive elements by rotating the previous
3621
 
                 * value left 1 bit, then XOR'ing in the new element's hash value.
 
3620
                 * Combine hash values of successive elements by multiplying the
 
3621
                 * current value by 31 and adding on the new element's hash value.
 
3622
                 *
 
3623
                 * The result is a sum in which each element's hash value is
 
3624
                 * multiplied by a different power of 31. This is modulo 2^32
 
3625
                 * arithmetic, and the powers of 31 modulo 2^32 form a cyclic group of
 
3626
                 * order 2^27. So for arrays of up to 2^27 elements, each element's
 
3627
                 * hash value is multiplied by a different (odd) number, resulting in
 
3628
                 * a good mixing of all the elements' hash values.
3622
3629
                 */
3623
 
                result = (result << 1) | (result >> 31);
3624
 
                result ^= elthash;
 
3630
                result = (result << 5) - result + elthash;
3625
3631
        }
3626
3632
 
3627
3633
        /* Avoid leaking memory when handed toasted input. */
4805
4811
        if (PG_ARGISNULL(1) || PG_ARGISNULL(2))
4806
4812
                ereport(ERROR,
4807
4813
                                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
4808
 
                           errmsg("dimension array or low bound array cannot be NULL")));
 
4814
                           errmsg("dimension array or low bound array cannot be null")));
4809
4815
 
4810
4816
        dims = PG_GETARG_ARRAYTYPE_P(1);
4811
4817
        lbs = PG_GETARG_ARRAYTYPE_P(2);
4845
4851
        if (PG_ARGISNULL(1))
4846
4852
                ereport(ERROR,
4847
4853
                                (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
4848
 
                           errmsg("dimension array or low bound array cannot be NULL")));
 
4854
                           errmsg("dimension array or low bound array cannot be null")));
4849
4855
 
4850
4856
        dims = PG_GETARG_ARRAYTYPE_P(1);
4851
4857