41 |
|
static SCAN *freelist; /* scanline free list */ |
42 |
|
static SCAN *hashtab[HSIZE]; /* scanline hash table */ |
43 |
|
|
44 |
+ |
static long scanbufsiz; /* size of allocated scanline buffer */ |
45 |
+ |
|
46 |
|
static long ncall = 0L; /* number of calls to getpictscan */ |
47 |
|
static long nread = 0L; /* number of scanlines read */ |
48 |
|
static long nrecl = 0L; /* number of scanlines reclaimed */ |
292 |
|
char *fn; |
293 |
|
{ |
294 |
|
if ((pictfp = fopen(fn, "r")) == NULL) { |
295 |
< |
fprintf("%s: cannot open\n", fn); |
295 |
> |
fprintf(stderr, "%s: cannot open\n", fn); |
296 |
|
exit(1); |
297 |
|
} |
298 |
|
exposure = 1.0; |
400 |
|
register SCAN *ptr; |
401 |
|
register int i; |
402 |
|
/* initialize positions */ |
403 |
< |
scanpos = (long *)malloc(pysiz*sizeof(long)); |
403 |
> |
scanpos = (long *)bmalloc(pysiz*sizeof(long)); |
404 |
|
if (scanpos == NULL) |
405 |
|
memerr("scanline positions"); |
406 |
|
for (i = pysiz-1; i >= 0; i--) |
417 |
|
i = MAXSBUF / scansize; /* compute number to allocate */ |
418 |
|
if (i > HSIZE) |
419 |
|
i = HSIZE; |
420 |
< |
scan_buf = malloc(i*scansize); /* get in one big chunk */ |
420 |
> |
scanbufsiz = i*scansize; |
421 |
> |
scan_buf = bmalloc(scanbufsiz); /* get in one big chunk */ |
422 |
|
if (scan_buf == NULL) |
423 |
|
memerr("scanline buffers"); |
424 |
|
ptr = (SCAN *)scan_buf; |
435 |
|
|
436 |
|
donescans() /* free up scanlines */ |
437 |
|
{ |
438 |
< |
free(scan_buf); |
439 |
< |
free((char *)scanpos); |
438 |
> |
bfree(scan_buf, scanbufsiz); |
439 |
> |
bfree((char *)scanpos, pysiz*sizeof(long)); |
440 |
|
} |