version 1.9, 2003/06/03 02:56:16 |
version 1.10, 2004/03/15 13:35:36 |
|
|
mfct++; |
mfct++; |
/* reduce number of open files */ |
/* reduce number of open files */ |
if (mfct == 16 ||(c == EOF && ntfiles)) { |
if (mfct == 16 ||(c == EOF && ntfiles)) { |
tmpbuf = malloc(bufend - |
/* |
crec->data); |
* Only copy extra incomplete |
if (tmpbuf == NULL) |
* crec data if there is any. |
errx(2, "cannot " |
*/ |
"allocate memory"); |
int nodata = (bufend |
memmove(tmpbuf, crec->data, |
>= (u_char *)crec |
bufend - crec->data); |
&& bufend <= crec->data); |
|
size_t sz = 0; |
|
|
|
if (!nodata) { |
|
sz = bufend |
|
- crec->data; |
|
tmpbuf = malloc(sz); |
|
if (tmpbuf == NULL) |
|
errx(2, "cannot" |
|
" allocate" |
|
" memory"); |
|
memmove(tmpbuf, |
|
crec->data, sz); |
|
} |
|
|
fstack[tfiles.top + ntfiles].fp |
fstack[tfiles.top + ntfiles].fp |
= ftmp(); |
= ftmp(); |
fmerge(0, mstart, mfct, geteasy, |
fmerge(0, mstart, mfct, geteasy, |
|
|
putrec, ftbl); |
putrec, ftbl); |
ntfiles++; |
ntfiles++; |
mfct = 0; |
mfct = 0; |
memmove(crec->data, tmpbuf, |
|
bufend - crec->data); |
if (!nodata) { |
free(tmpbuf); |
memmove(crec->data, |
|
tmpbuf, sz); |
|
free(tmpbuf); |
|
} |
} |
} |
} else { |
} else { |
fstack[tfiles.top + ntfiles].fp= ftmp(); |
fstack[tfiles.top + ntfiles].fp= ftmp(); |