|
From: <kin...@us...> - 2004-03-13 20:12:04
|
Update of /cvsroot/teem/teem/src/nrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26582/nrrd Modified Files: axis.c formatNRRD.c formatPNG.c gzio.c histogram.c keyvalue.c measure.c methodsNrrd.c read.c reorder.c resampleNrrd.c simple.c Log Message: killed off AIR_FREE and AIR_FCLOSE macros- they were just way too cute for their own good Index: axis.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/axis.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** axis.c 7 Jan 2004 15:34:30 -0000 1.5 --- axis.c 13 Mar 2004 20:03:10 -0000 1.6 *************** *** 30,35 **** axis->spacing = AIR_NAN; axis->min = axis->max = AIR_NAN; ! AIR_FREE(axis->label); ! AIR_FREE(axis->unit); axis->center = nrrdCenterUnknown; } --- 30,35 ---- axis->spacing = AIR_NAN; axis->min = axis->max = AIR_NAN; ! axis->label = airFree(axis->label); ! axis->unit = airFree(axis->unit); axis->center = nrrdCenterUnknown; } *************** *** 53,59 **** if (axis) { ! AIR_FREE(axis->label); ! AIR_FREE(axis->unit); ! AIR_FREE(axis); } return NULL; --- 53,59 ---- if (axis) { ! axis->label = airFree(axis->label); ! axis->unit = airFree(axis->unit); ! axis = airFree(axis); } return NULL; *************** *** 83,87 **** if (!(NRRD_AXIS_INFO_LABEL_BIT & bitflag)) { if (dest->label != src->label) { ! AIR_FREE(dest->label); dest->label = airStrdup(src->label); } --- 83,87 ---- if (!(NRRD_AXIS_INFO_LABEL_BIT & bitflag)) { if (dest->label != src->label) { ! dest->label = airFree(dest->label); dest->label = airStrdup(src->label); } *************** *** 89,93 **** if (!(NRRD_AXIS_INFO_UNIT_BIT & bitflag)) { if (dest->unit != src->unit) { ! AIR_FREE(dest->unit); dest->unit = airStrdup(src->unit); } --- 89,93 ---- if (!(NRRD_AXIS_INFO_UNIT_BIT & bitflag)) { if (dest->unit != src->unit) { ! dest->unit = airFree(dest->unit); dest->unit = airStrdup(src->unit); } *************** *** 185,193 **** break; case nrrdAxisInfoLabel: ! AIR_FREE(nrrd->axis[d].label); nrrd->axis[d].label = airStrdup(info.CP[d]); break; case nrrdAxisInfoUnit: ! AIR_FREE(nrrd->axis[d].unit); nrrd->axis[d].unit = airStrdup(info.CP[d]); break; --- 185,193 ---- break; case nrrdAxisInfoLabel: ! nrrd->axis[d].label = airFree(nrrd->axis[d].label); nrrd->axis[d].label = airStrdup(info.CP[d]); break; case nrrdAxisInfoUnit: ! nrrd->axis[d].unit = airFree(nrrd->axis[d].unit); nrrd->axis[d].unit = airStrdup(info.CP[d]); break; Index: formatNRRD.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/formatNRRD.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** formatNRRD.c 7 Jan 2004 15:34:30 -0000 1.5 --- formatNRRD.c 13 Mar 2004 20:03:10 -0000 1.6 *************** *** 285,289 **** } else { if (nio->detachedHeader) { ! AIR_FCLOSE(nio->dataFile); /* fprintf(stderr, "!%s: nio->dataFile = %p\n", me, nio->dataFile); */ } else { --- 285,289 ---- } else { if (nio->detachedHeader) { ! nio->dataFile = airFclose(nio->dataFile); /* fprintf(stderr, "!%s: nio->dataFile = %p\n", me, nio->dataFile); */ } else { *************** *** 380,384 **** } if (nio->detachedHeader) { ! AIR_FCLOSE(nio->dataFile); } else { nio->dataFile = NULL; --- 380,384 ---- } if (nio->detachedHeader) { ! nio->dataFile = airFclose(nio->dataFile); } else { nio->dataFile = NULL; Index: formatPNG.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/formatPNG.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** formatPNG.c 7 Jan 2004 15:34:30 -0000 1.5 --- formatPNG.c 13 Mar 2004 20:03:10 -0000 1.6 *************** *** 311,315 **** descriptor did NOT come from a line of text as read by _nrrdOneLine */ ! AIR_FREE(nio->line); nio->line = airStrdup(txt[i].text); ret = _nrrdReadNrrdParseField(nrrd, nio, AIR_FALSE); --- 311,315 ---- descriptor did NOT come from a line of text as read by _nrrdOneLine */ ! nio->line = airFree(nio->line); nio->line = airStrdup(txt[i].text); ret = _nrrdReadNrrdParseField(nrrd, nio, AIR_FALSE); *************** *** 366,370 **** png_read_end(png, info); /* clean up */ ! AIR_FREE(row); png_destroy_read_struct(&png, &info, NULL); --- 366,370 ---- png_read_end(png, info); /* clean up */ ! row = airFree(row); png_destroy_read_struct(&png, &info, NULL); *************** *** 515,521 **** /* clean up */ for (i=0; i<numtxt; i++) { ! AIR_FREE(txt[i].text); } ! AIR_FREE(row); png_destroy_write_struct(&png, &info); --- 515,521 ---- /* clean up */ for (i=0; i<numtxt; i++) { ! txt[i].text = airFree(txt[i].text); } ! row = airFree(row); png_destroy_write_struct(&png, &info); Index: gzio.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/gzio.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gzio.c 7 Jan 2004 15:34:30 -0000 1.15 --- gzio.c 13 Mar 2004 20:03:10 -0000 1.16 *************** *** 556,560 **** return 1; } ! AIR_FREE(s->msg); if (s->stream.state != NULL) { if (s->mode == 'w') { --- 556,560 ---- return 1; } ! s->msg = airFree(s->msg); if (s->stream.state != NULL) { if (s->mode == 'w') { *************** *** 573,579 **** biffAdd(NRRD, err); } ! AIR_FREE(s->inbuf); ! AIR_FREE(s->outbuf); ! AIR_FREE(s); return error != Z_OK; } --- 573,579 ---- biffAdd(NRRD, err); } ! s->inbuf = airFree(s->inbuf); ! s->outbuf = airFree(s->outbuf); ! s = airFree(s); return error != Z_OK; } Index: histogram.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/histogram.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** histogram.c 7 Jan 2004 15:34:30 -0000 1.48 --- histogram.c 13 Mar 2004 20:03:10 -0000 1.49 *************** *** 138,142 **** biffAdd(NRRD, err); airMopError(mop); return 1; } ! AIR_FREE(nout->axis[0].label); nout->axis[0].label = airStrdup(nout->content); --- 138,142 ---- biffAdd(NRRD, err); airMopError(mop); return 1; } ! nout->axis[0].label = airFree(nout->axis[0].label); nout->axis[0].label = airStrdup(nout->content); *************** *** 188,192 **** nout->axis[0].center = nout->axis[1].center = nrrdCenterCell; nout->axis[0].label = airStrdup(nin->axis[0].label); ! AIR_FREE(nout->axis[1].label); nrrdPeripheralInit(nout); pgmData = nout->data; --- 188,192 ---- nout->axis[0].center = nout->axis[1].center = nrrdCenterCell; nout->axis[0].label = airStrdup(nin->axis[0].label); ! nout->axis[1].label = airFree(nout->axis[1].label); nrrdPeripheralInit(nout); pgmData = nout->data; *************** *** 506,510 **** } } else { ! AIR_FREE(nout->axis[d].label); totalContentStrlen += 2; } --- 506,510 ---- } } else { ! nout->axis[d].label = airFree(nout->axis[d].label); totalContentStrlen += 2; } Index: keyvalue.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/keyvalue.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** keyvalue.c 13 Feb 2004 03:40:58 -0000 1.7 --- keyvalue.c 13 Mar 2004 20:03:10 -0000 1.8 *************** *** 93,98 **** nk = nrrd->kvpArr->len; for (ki=0; ki<nk; ki++) { ! AIR_FREE(nrrd->kvp[0 + 2*ki]); ! AIR_FREE(nrrd->kvp[1 + 2*ki]); } airArraySetLen(nrrd->kvpArr, 0); --- 93,98 ---- nk = nrrd->kvpArr->len; for (ki=0; ki<nk; ki++) { ! nrrd->kvp[0 + 2*ki] = airFree(nrrd->kvp[0 + 2*ki]); ! nrrd->kvp[1 + 2*ki] = airFree(nrrd->kvp[1 + 2*ki]); } airArraySetLen(nrrd->kvpArr, 0); *************** *** 113,118 **** return 0; } ! AIR_FREE(nrrd->kvp[0 + 2*ki]); ! AIR_FREE(nrrd->kvp[1 + 2*ki]); nk = nrrd->kvpArr->len; for (; ki<nk-1; ki++) { --- 113,118 ---- return 0; } ! nrrd->kvp[0 + 2*ki] = airFree(nrrd->kvp[0 + 2*ki]); ! nrrd->kvp[1 + 2*ki] = airFree(nrrd->kvp[1 + 2*ki]); nk = nrrd->kvpArr->len; for (; ki<nk-1; ki++) { *************** *** 144,148 **** } if (-1 != (ki = _nrrdKeyValueIdxFind(nrrd, key))) { ! AIR_FREE(nrrd->kvp[1 + 2*ki]); nrrd->kvp[1 + 2*ki] = airStrdup(value); } else { --- 144,148 ---- } if (-1 != (ki = _nrrdKeyValueIdxFind(nrrd, key))) { ! nrrd->kvp[1 + 2*ki] = airFree(nrrd->kvp[1 + 2*ki]); nrrd->kvp[1 + 2*ki] = airStrdup(value); } else { Index: measure.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/measure.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** measure.c 7 Jan 2004 15:34:30 -0000 1.46 --- measure.c 13 Mar 2004 20:03:10 -0000 1.47 *************** *** 878,882 **** nrrdPeripheralInit(nout); ! AIR_FREE(_line); return 0; } --- 878,882 ---- nrrdPeripheralInit(nout); ! _line = airFree(_line); return 0; } Index: methodsNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/methodsNrrd.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** methodsNrrd.c 16 Jan 2004 17:35:12 -0000 1.39 --- methodsNrrd.c 13 Mar 2004 20:03:10 -0000 1.40 *************** *** 28,35 **** if (nio) { ! AIR_FREE(nio->path); ! AIR_FREE(nio->base); ! AIR_FREE(nio->dataFN); ! AIR_FREE(nio->line); nio->lineLen = 0; nio->pos = 0; --- 28,35 ---- if (nio) { ! nio->path = airFree(nio->path); ! nio->base = airFree(nio->base); ! nio->dataFN = airFree(nio->dataFN); ! nio->line = airFree(nio->line); nio->lineLen = 0; nio->pos = 0; *************** *** 77,86 **** NrrdIoState * nrrdIoStateNix (NrrdIoState *nio) { ! ! AIR_FREE(nio->path); ! AIR_FREE(nio->base); ! AIR_FREE(nio->dataFN); ! AIR_FREE(nio->line); ! AIR_FREE(nio); /* the NrrdIoState never owned nio->oldData; we don't free it */ return NULL; --- 77,86 ---- NrrdIoState * nrrdIoStateNix (NrrdIoState *nio) { ! ! nio->path = airFree(nio->path); ! nio->base = airFree(nio->base); ! nio->dataFN = airFree(nio->dataFN); ! nio->line = airFree(nio->line); ! nio = airFree(nio); /* the NrrdIoState never owned nio->oldData; we don't free it */ return NULL; *************** *** 126,130 **** nrrdResampleInfoNix (NrrdResampleInfo *info) { ! AIR_FREE(info); return NULL; } --- 126,130 ---- nrrdResampleInfoNix (NrrdResampleInfo *info) { ! info = airFree(info); return NULL; } *************** *** 150,154 **** nrrdKernelSpecNix (NrrdKernelSpec *ksp) { ! AIR_FREE(ksp); return NULL; } --- 150,154 ---- nrrdKernelSpecNix (NrrdKernelSpec *ksp) { ! ksp = airFree(ksp); return NULL; } *************** *** 200,204 **** if (nrrd) { ! AIR_FREE(nrrd->data); nrrd->type = nrrdTypeUnknown; nrrd->dim = 0; --- 200,204 ---- if (nrrd) { ! nrrd->data = airFree(nrrd->data); nrrd->type = nrrdTypeUnknown; nrrd->dim = 0; *************** *** 208,212 **** } ! AIR_FREE(nrrd->content); nrrd->blockSize = 0; nrrd->oldMin = nrrd->oldMax = AIR_NAN; --- 208,212 ---- } ! nrrd->content = airFree(nrrd->content); nrrd->blockSize = 0; nrrd->oldMin = nrrd->oldMax = AIR_NAN; *************** *** 284,291 **** if (nrrd) { ! AIR_FREE(nrrd->content); /* HEY: this is a symptom of some stupidity, no? */ for (i=0; i<NRRD_DIM_MAX; i++) { ! AIR_FREE(nrrd->axis[i].label); } nrrdCommentClear(nrrd); --- 284,291 ---- if (nrrd) { ! nrrd->content = airFree(nrrd->content); /* HEY: this is a symptom of some stupidity, no? */ for (i=0; i<NRRD_DIM_MAX; i++) { ! nrrd->axis[i].label = airFree(nrrd->axis[i].label); } nrrdCommentClear(nrrd); *************** *** 293,297 **** nrrdKeyValueClear(nrrd); nrrd->kvpArr = airArrayNix(nrrd->kvpArr); ! AIR_FREE(nrrd); } return NULL; --- 293,297 ---- nrrdKeyValueClear(nrrd); nrrd->kvpArr = airArrayNix(nrrd->kvpArr); ! nrrd = airFree(nrrd); } return NULL; *************** *** 309,313 **** if (nrrd) { ! AIR_FREE(nrrd->data); nrrdInit(nrrd); } --- 309,313 ---- if (nrrd) { ! nrrd->data = airFree(nrrd->data); nrrdInit(nrrd); } *************** *** 482,486 **** /* HEY: shouldn't this be handled with nrrdPeripheralCopy() */ ! AIR_FREE(nout->content); nout->content = airStrdup(nin->content); if (nin->content && !nout->content) { --- 482,486 ---- /* HEY: shouldn't this be handled with nrrdPeripheralCopy() */ ! nout->content = airFree(nout->content); nout->content = airStrdup(nin->content); if (nin->content && !nout->content) { *************** *** 553,557 **** nrrd->type = type; ! AIR_FREE(nrrd->data); nrrd->dim = dim; if (_nrrdSizeCheck(dim, size, AIR_TRUE)) { --- 553,557 ---- nrrd->type = type; ! nrrd->data = airFree(nrrd->data); nrrd->dim = dim; if (_nrrdSizeCheck(dim, size, AIR_TRUE)) { Index: read.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/read.c,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** read.c 13 Feb 2004 03:40:58 -0000 1.87 --- read.c 13 Mar 2004 20:03:10 -0000 1.88 *************** *** 137,141 **** memset(nrrd->data, 0, needDataSize); } else { ! AIR_FREE(nrrd->data); nrrd->data = calloc(nrrdElementNumber(nrrd), nrrdElementSize(nrrd)); if (!nrrd->data) { --- 137,141 ---- memset(nrrd->data, 0, needDataSize); } else { ! nrrd->data = airFree(nrrd->data); nrrd->data = calloc(nrrdElementNumber(nrrd), nrrdElementSize(nrrd)); if (!nrrd->data) { *************** *** 312,316 **** /* free prior memory if we didn't end up using it */ if (nio->oldData != nrrd->data) { ! AIR_FREE(nio->oldData); nio->oldDataSize = 0; } --- 312,316 ---- /* free prior memory if we didn't end up using it */ if (nio->oldData != nrrd->data) { ! nio->oldData = airFree(nio->oldData); nio->oldDataSize = 0; } *************** *** 336,343 **** if (dirP) { ! AIR_FREE(*dirP); } if (baseP) { ! AIR_FREE(*baseP); } where = strrchr(name, '/'); --- 336,343 ---- if (dirP) { ! *dirP = airFree(*dirP); } if (baseP) { ! *baseP = airFree(*baseP); } where = strrchr(name, '/'); Index: reorder.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/reorder.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** reorder.c 7 Jan 2004 15:34:30 -0000 1.55 --- reorder.c 13 Mar 2004 20:03:10 -0000 1.56 *************** *** 435,439 **** nout->axis[axis].min = nin->axis[axis].max; nout->axis[axis].max = nin->axis[axis].min; ! AIR_FREE(perm); return 0; } --- 435,439 ---- nout->axis[axis].min = nin->axis[axis].max; nout->axis[axis].max = nin->axis[axis].min; ! perm = airFree(perm); return 0; } Index: resampleNrrd.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/resampleNrrd.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** resampleNrrd.c 7 Jan 2004 15:34:30 -0000 1.19 --- resampleNrrd.c 13 Mar 2004 20:03:10 -0000 1.20 *************** *** 673,677 **** } else { airMopSub(mop, array[pass-1], airFree); ! AIR_FREE(array[pass-1]); /* printf("%s: pass %d: freeing array[%d]\n", me, pass, pass-1); --- 673,677 ---- } else { airMopSub(mop, array[pass-1], airFree); ! array[pass-1] = airFree(array[pass-1]); /* printf("%s: pass %d: freeing array[%d]\n", me, pass, pass-1); *************** *** 770,776 **** airMopSub(mop, index, airFree); airMopSub(mop, inVec, airFree); ! AIR_FREE(weight); ! AIR_FREE(index); ! AIR_FREE(inVec); } --- 770,776 ---- airMopSub(mop, index, airFree); airMopSub(mop, inVec, airFree); ! weight = airFree(weight); ! index = airFree(index); ! inVec = airFree(inVec); } *************** *** 778,782 **** if (passes > 1) { airMopSub(mop, array[passes-1], airFree); ! AIR_FREE(array[passes-1]); /* printf("%s: now freeing array[%d]\n", me, passes-1); --- 778,782 ---- if (passes > 1) { airMopSub(mop, array[passes-1], airFree); ! array[passes-1] = airFree(array[passes-1]); /* printf("%s: now freeing array[%d]\n", me, passes-1); Index: simple.c =================================================================== RCS file: /cvsroot/teem/teem/src/nrrd/simple.c,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** simple.c 7 Jan 2004 15:34:30 -0000 1.59 --- simple.c 13 Mar 2004 20:03:10 -0000 1.60 *************** *** 118,122 **** biffAdd(NRRD, err); return 1; } ! AIR_FREE(nout->content); /* we are currently praying that this won't overflow the "buff" array */ --- 118,122 ---- biffAdd(NRRD, err); return 1; } ! nout->content = airFree(nout->content); /* we are currently praying that this won't overflow the "buff" array */ *************** *** 134,142 **** if (!nout->content) { sprintf(err, "%s: couln't alloc output content!", me); ! biffAdd(NRRD, err); AIR_FREE(buff); return 1; } sprintf(nout->content, "%s(%s%s%s)", func, content, airStrlen(buff) ? "," : "", buff); ! AIR_FREE(buff); return 0; } --- 134,142 ---- if (!nout->content) { sprintf(err, "%s: couln't alloc output content!", me); ! biffAdd(NRRD, err); buff = airFree(buff); return 1; } sprintf(nout->content, "%s(%s%s%s)", func, content, airStrlen(buff) ? "," : "", buff); ! buff = airFree(buff); return 0; } *************** *** 184,188 **** if (nrrdStateDisableContent) { /* we kill content always */ ! AIR_FREE(nout->content); return 0; } --- 184,188 ---- if (nrrdStateDisableContent) { /* we kill content always */ ! nout->content = airFree(nout->content); return 0; } *************** *** 190,194 **** /* there's no input content, and we're not supposed to invent any content, so after freeing nout's content we're done */ ! AIR_FREE(nout->content); return 0; } --- 190,194 ---- /* there's no input content, and we're not supposed to invent any content, so after freeing nout's content we're done */ ! nout->content = airFree(nout->content); return 0; } |