1194{
1195 const uint32_t set_count = 2;
1197 int pgrastpos[2] = {-1, -1};
1199
1200 uint32_t i;
1201 uint32_t j;
1202 uint32_t k;
1203 int rtn;
1204 int aligned = 0;
1205 char *reason = NULL;
1206
1207 for (i = 0, j = 0; i < set_count; i++) {
1208
1209 if (PG_ARGISNULL(j)) {
1210 for (k = 0; k < i; k++) {
1212 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1213 }
1214 PG_RETURN_NULL();
1215 }
1217 pgrastpos[i] = j;
1218 j++;
1219
1220
1222 if (!rast[i]) {
1223 for (k = 0; k <= i; k++) {
1224 if (k < i)
1226 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1227 }
1228 elog(ERROR, "RASTER_sameAlignment: Could not deserialize the %s raster", i < 1 ? "first" : "second");
1229 PG_RETURN_NULL();
1230 }
1231 }
1232
1234 rast[0],
1235 rast[1],
1236 &aligned,
1237 &reason
1238 );
1239 for (k = 0; k < set_count; k++) {
1241 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1242 }
1243
1245 elog(ERROR, "RASTER_sameAlignment: Could not test for alignment on the two rasters");
1246 PG_RETURN_NULL();
1247 }
1248
1249
1250 if (reason != NULL && !aligned)
1251 elog(NOTICE, "%s", reason);
1252
1253 PG_RETURN_BOOL(aligned);
1254}
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_errorstate rt_raster_same_alignment(rt_raster rast1, rt_raster rast2, int *aligned, char **reason)
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.