/rtmp/cube.diff
text/x-diff
Filename: /rtmp/cube.diff
Type: text/x-diff
Part: 0
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c new file mode 100644 index b0564f7..5159be4 *** a/contrib/cube/cube.c --- b/contrib/cube/cube.c *************** cube_a_f8_f8(PG_FUNCTION_ARGS) *** 199,205 **** dur = ARRPTR(ur); dll = ARRPTR(ll); ! size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; --- 199,205 ---- dur = ARRPTR(ur); dll = ARRPTR(ll); ! size = offsetof(NDBOX, x) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; *************** cube_a_f8(PG_FUNCTION_ARGS) *** 235,241 **** dur = ARRPTR(ur); ! size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; --- 235,241 ---- dur = ARRPTR(ur); ! size = offsetof(NDBOX, x) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; *************** cube_subset(PG_FUNCTION_ARGS) *** 268,274 **** dx = (int4 *) ARR_DATA_PTR(idx); dim = ARRNELEMS(idx); ! size = offsetof(NDBOX, x[0]) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; --- 268,274 ---- dx = (int4 *) ARR_DATA_PTR(idx); dim = ARRNELEMS(idx); ! size = offsetof(NDBOX, x) +sizeof(double) * 2 * dim; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; *************** cube_enlarge(PG_FUNCTION_ARGS) *** 1373,1379 **** dim = n; if (a->dim > dim) dim = a->dim; ! size = offsetof(NDBOX, x[0]) +sizeof(double) * dim * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; --- 1373,1379 ---- dim = n; if (a->dim > dim) dim = a->dim; ! size = offsetof(NDBOX, x) +sizeof(double) * dim * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = dim; *************** cube_f8(PG_FUNCTION_ARGS) *** 1414,1420 **** NDBOX *result; int size; ! size = offsetof(NDBOX, x[0]) +sizeof(double) * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = 1; --- 1414,1420 ---- NDBOX *result; int size; ! size = offsetof(NDBOX, x) +sizeof(double) * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = 1; *************** cube_f8_f8(PG_FUNCTION_ARGS) *** 1432,1438 **** NDBOX *result; int size; ! size = offsetof(NDBOX, x[0]) +sizeof(double) * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = 1; --- 1432,1438 ---- NDBOX *result; int size; ! size = offsetof(NDBOX, x) +sizeof(double) * 2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = 1; *************** cube_c_f8(PG_FUNCTION_ARGS) *** 1453,1459 **** int size; int i; ! size = offsetof(NDBOX, x[0]) +sizeof(double) * (c->dim + 1) *2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = c->dim + 1; --- 1453,1459 ---- int size; int i; ! size = offsetof(NDBOX, x) +sizeof(double) * (c->dim + 1) *2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = c->dim + 1; *************** cube_c_f8_f8(PG_FUNCTION_ARGS) *** 1480,1486 **** int size; int i; ! size = offsetof(NDBOX, x[0]) +sizeof(double) * (c->dim + 1) *2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = c->dim + 1; --- 1480,1486 ---- int size; int i; ! size = offsetof(NDBOX, x) +sizeof(double) * (c->dim + 1) *2; result = (NDBOX *) palloc0(size); SET_VARSIZE(result, size); result->dim = c->dim + 1;