mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 09:25:41 +02:00
Close original geometry temp files as soon as they are no longer needed
This commit is contained in:
@@ -1548,8 +1548,8 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nmerges; i++) {
|
for (i = 0; i < nmerges; i++) {
|
||||||
if (!quiet) {
|
if (!quiet && nmerges > 1) {
|
||||||
fprintf(stderr, "Reordering geometry: part %d of %d \r", i, nmerges);
|
fprintf(stderr, "Reordering geometry: part %d of %d \r", i + 1, nmerges);
|
||||||
}
|
}
|
||||||
|
|
||||||
long long j;
|
long long j;
|
||||||
@@ -1566,7 +1566,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
ix->end = geompos;
|
ix->end = geompos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!quiet) {
|
if (!quiet && nmerges > 1) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1579,7 +1579,7 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = fopen(indexname, "w");
|
FILE *f = fopen(indexname, "wb");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
perror(indexname);
|
perror(indexname);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@@ -1597,6 +1597,17 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < CPUS; i++) {
|
||||||
|
if (reader[i].geomst.st_size > 0) {
|
||||||
|
if (munmap(reader[i].geom_map, reader[i].geomst.st_size) != 0) {
|
||||||
|
perror("unmap unsorted geometry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (close(reader[i].geomfd) != 0) {
|
||||||
|
perror("close unsorted geometry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
geompos = 0;
|
geompos = 0;
|
||||||
|
|
||||||
/* initial tile is 0/0/0 */
|
/* initial tile is 0/0/0 */
|
||||||
@@ -1809,16 +1820,6 @@ int read_json(int argc, char **argv, char *fname, const char *layername, int max
|
|||||||
perror("unmap sorted index");
|
perror("unmap sorted index");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CPUS; i++) {
|
|
||||||
if (reader[i].geomst.st_size > 0) {
|
|
||||||
if (munmap(reader[i].geom_map, reader[i].geomst.st_size) != 0) {
|
|
||||||
perror("unmap unsorted geometry");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (close(reader[i].geomfd) != 0) {
|
|
||||||
perror("close unsorted geometry");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (close(indexfd) != 0) {
|
if (close(indexfd) != 0) {
|
||||||
perror("close sorted index");
|
perror("close sorted index");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user