IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7647


Ignore:
Timestamp:
Jun 22, 2006, 4:11:01 PM (20 years ago)
Author:
Paul Price
Message:

Calling psLibInit() to allow memory checking at exit; removing our own memory checking in favour of use of PS_MEMORY_CHECK feature; calling psLibFinalize instead of a whole bunch of other functions.

Location:
trunk/ppImage/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImage.c

    r7639 r7647  
    22
    33int main(int argc, char **argv) {
     4
     5    psLibInit(NULL);
    46
    57    psTimerStart(TIMERNAME);
     
    1113    pmConfig *config = ppImageArguments(&argc, argv);
    1214    if (config == NULL) {
    13         psErrorStackPrint(stderr, "");
    14         exit(1);
     15        psErrorStackPrint(stderr, "");
     16        exit(1);
    1517    }
    1618
     
    1921    ppImageOptions *options = ppImageParseCamera(config);
    2022    if (options == NULL) {
    21         psErrorStackPrint(stderr, "");
    22         exit(1);
     23        psErrorStackPrint(stderr, "");
     24        exit(1);
    2325    }
    2426
    2527    // Image Arithmetic Loop
    2628    if (!ppImageLoop(config, options)) {
    27         psErrorStackPrint(stderr, "");
    28         exit(1);
     29        psErrorStackPrint(stderr, "");
     30        exit(1);
    2931    }
    3032
     
    4244    psMetadataIterator *iter = psMetadataIteratorAlloc (config->files, PS_LIST_HEAD, NULL);
    4345    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
    44         pmFPAfile *file = item->data.V;
    45         pmFPA *fpa = file->fpa;
    46         fprintf (stderr, "file %s\n", file->name);
    47         if (!fpa) {
    48             fprintf (stderr, "  has no FPA\n");
    49             continue;
    50         }
    51         if (fpa->hdu) {
    52             if (fpa->hdu->images) fprintf (stderr, "  (%d,%d) images\n", -1, -1);
    53             if (fpa->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", -1, -1);
    54             if (fpa->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", -1, -1);
    55             if (fpa->hdu->header) fprintf (stderr, "  (%d,%d) header\n", -1, -1);
    56             continue;
    57         }
    58         fprintf (stderr, "  has no fpa data (%d,%d)\n", -1, -1);
    59         for (int i = 0; i < fpa->chips->n; i++) {
    60             pmChip *chip = fpa->chips->data[i];
    61             if (chip->hdu) {
    62                 if (chip->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, -1);
    63                 if (chip->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, -1);
    64                 if (chip->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, -1);
    65                 if (chip->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, -1);
    66                 continue;
    67             }
    68             fprintf (stderr, "  has no chip data (%d,%d)\n", i, -1);
    69             for (int j = 0; j < chip->cells->n; j++) {
    70                 pmCell *cell = chip->cells->data[j];
    71                 if (cell->hdu) {
    72                     if (cell->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, j);
    73                     if (cell->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, j);
    74                     if (cell->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, j);
    75                     if (cell->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, j);
    76                     continue;
    77                 }
    78                 fprintf (stderr, "  has no cell data (%d,%d)\n", i, j);
    79             }
    80         }
     46        pmFPAfile *file = item->data.V;
     47        pmFPA *fpa = file->fpa;
     48        fprintf (stderr, "file %s\n", file->name);
     49        if (!fpa) {
     50            fprintf (stderr, "  has no FPA\n");
     51            continue;
     52        }
     53        if (fpa->hdu) {
     54            if (fpa->hdu->images) fprintf (stderr, "  (%d,%d) images\n", -1, -1);
     55            if (fpa->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", -1, -1);
     56            if (fpa->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", -1, -1);
     57            if (fpa->hdu->header) fprintf (stderr, "  (%d,%d) header\n", -1, -1);
     58            continue;
     59        }
     60        fprintf (stderr, "  has no fpa data (%d,%d)\n", -1, -1);
     61        for (int i = 0; i < fpa->chips->n; i++) {
     62            pmChip *chip = fpa->chips->data[i];
     63            if (chip->hdu) {
     64                if (chip->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, -1);
     65                if (chip->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, -1);
     66                if (chip->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, -1);
     67                if (chip->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, -1);
     68                continue;
     69            }
     70            fprintf (stderr, "  has no chip data (%d,%d)\n", i, -1);
     71            for (int j = 0; j < chip->cells->n; j++) {
     72                pmCell *cell = chip->cells->data[j];
     73                if (cell->hdu) {
     74                    if (cell->hdu->images) fprintf (stderr, "  (%d,%d) images\n", i, j);
     75                    if (cell->hdu->weights) fprintf (stderr, "  (%d,%d) weights\n", i, j);
     76                    if (cell->hdu->masks) fprintf (stderr, "  (%d,%d) masks\n", i, j);
     77                    if (cell->hdu->header) fprintf (stderr, "  (%d,%d) header\n", i, j);
     78                    continue;
     79                }
     80                fprintf (stderr, "  has no cell data (%d,%d)\n", i, j);
     81            }
     82        }
    8183    }
    8284    psFree (iter);
  • trunk/ppImage/src/ppImageCleanup.c

    r7639 r7647  
    33void ppImageCleanup (pmConfig *config, ppImageOptions *options) {
    44
     5    // Free memory used by ppImage
    56    psFree(options);
    67    psFree(config);
    78
    8     psTimerStop();
    9     psMemCheckCorruption (true);
    10     psTraceReset();
     9    // Free memory used by psModules
    1110    pmConceptsDone();
    1211    pmConfigDone();
    1312    pmModelGroupCleanup();
    14     fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, NULL, false), "ppImage");
    15     // fprintf (stderr, "found %d leaks at %s\n", psMemCheckLeaks (0, NULL, stdout, false), "ppImage");
     13
     14    // Free memory used by psLib
     15    psLibFinalize();
     16
    1617    return;
    1718}
Note: See TracChangeset for help on using the changeset viewer.