5 |
|
* Sorting routines for meta-files |
6 |
|
*/ |
7 |
|
|
8 |
< |
#include "paths.h" |
8 |
> |
#include "rtprocess.h" /* getpid() */ |
9 |
> |
#include "rterror.h" |
10 |
|
#include "meta.h" |
11 |
|
|
11 |
– |
#ifdef _WIN32 |
12 |
– |
#include <process.h> /* getpid() */ |
13 |
– |
#endif |
12 |
|
|
15 |
– |
|
13 |
|
#define PBSIZE 1000 /* max size of sort block */ |
14 |
|
/* maxalloc must be >= this */ |
15 |
|
|
80 |
|
*/ |
81 |
|
|
82 |
|
void |
83 |
< |
mergesort( /* merge sorted files with list */ |
83 |
> |
pmergesort( /* merge sorted files with list */ |
84 |
|
|
85 |
|
FILE *fi[], /* array of input files */ |
86 |
|
int nf, /* number of input files */ |
102 |
|
|
103 |
|
for (i = 0; i < nf; i++) { /* initialize input files */ |
104 |
|
if ((pp[i] = palloc()) == NULL) |
105 |
< |
error(SYSTEM, "memory exhausted in mergesort"); |
105 |
> |
error(SYSTEM, "memory exhausted in pmergesort"); |
106 |
|
readp(pp[i], fi[i]); |
107 |
|
} |
108 |
|
|
164 |
|
if ((fp = ofp) == NULL) |
165 |
|
fp = efopen(tfname(height + 1, nt), "w"); |
166 |
|
|
167 |
< |
mergesort(fi, nf, pl, pcmp, fp); |
167 |
> |
pmergesort(fi, nf, pl, pcmp, fp); |
168 |
|
|
169 |
|
for (i = 0; i < nf; i++) { |
170 |
|
fclose(fi[i]); |