1190{
1191 const uint32_t set_count = 2;
1193 int pgrastpos[2] = {-1, -1};
1195
1196 uint32_t i;
1197 uint32_t j;
1198 uint32_t k;
1199 int rtn;
1200 int aligned = 0;
1201 char *reason = NULL;
1202
1203 for (i = 0, j = 0; i < set_count; i++) {
1204
1205 if (PG_ARGISNULL(j)) {
1206 for (k = 0; k < i; k++) {
1208 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1209 }
1210 PG_RETURN_NULL();
1211 }
1213 pgrastpos[i] = j;
1214 j++;
1215
1216
1218 if (!rast[i]) {
1219 for (k = 0; k <= i; k++) {
1220 if (k < i)
1222 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1223 }
1224 elog(ERROR, "RASTER_sameAlignment: Could not deserialize the %s raster", i < 1 ? "first" : "second");
1225 PG_RETURN_NULL();
1226 }
1227 }
1228
1230 rast[0],
1231 rast[1],
1232 &aligned,
1233 &reason
1234 );
1235 for (k = 0; k < set_count; k++) {
1237 PG_FREE_IF_COPY(pgrast[k], pgrastpos[k]);
1238 }
1239
1241 elog(ERROR, "RASTER_sameAlignment: Could not test for alignment on the two rasters");
1242 PG_RETURN_NULL();
1243 }
1244
1245
1246 if (reason != NULL && !aligned)
1247 elog(NOTICE, "%s", reason);
1248
1249 PG_RETURN_BOOL(aligned);
1250}
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.