From a528ab8ce4e9625740e658131e7a60eea5ff4f5e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 5 Oct 2007 22:06:50 +0200 Subject: use one buffer only --- src/pnmlcms.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/pnmlcms.c b/src/pnmlcms.c index f139b0f..0a8fdac 100644 --- a/src/pnmlcms.c +++ b/src/pnmlcms.c @@ -125,20 +125,17 @@ pam_transform(FILE *in_fp, FILE *out_fp, { int row, col; int nbytes = in_pnm->maxval == 65535?2:1; - char *in_buf = malloc(in_pnm->width * nbytes * 3); - char *out_buf = malloc(in_pnm->width * nbytes * 3); + char *buf = malloc(in_pnm->width * nbytes * 3); for (row = 0; row < in_pnm->height; row++) { - fread(in_buf, in_pnm->width, nbytes * 3, in_fp); + fread(buf, in_pnm->width, nbytes * 3, in_fp); - cmsDoTransform(*hTransform, in_buf, out_buf, in_pnm->width); + cmsDoTransform(*hTransform, buf, buf, in_pnm->width); - fwrite(out_buf, in_pnm->width, nbytes * 3, out_fp); + fwrite(buf, in_pnm->width, nbytes * 3, out_fp); } - free(in_buf); - free(out_buf); - + free(buf); return 0; } -- cgit v1.2.3