IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 15, 2007, 3:52:15 PM (19 years ago)
Author:
jhoblitt
Message:

handle p0toolConfig() errors properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/regtoolConfig.c

    r11702 r11842  
    2828#include "p0tool.h"
    2929
    30 // this function can not fail -- exits on error
    31 pxConfig *p0toolConfig(pxConfig *config, int argc, char **argv) {
    32 
    33     psExit exit_status = PS_EXIT_SUCCESS;
    34 
     30pxConfig *p0toolConfig(pxConfig *config, int argc, char **argv)
     31{
    3532    if (!config) {
    3633        config = pxConfigAlloc();
     
    4340    if (!config->modules) {
    4441        psError(PXTOOLS_ERR_CONFIG, false, "Can't find site configuration");
    45         goto FAIL;
     42        psFree(config);
     43        return NULL;
    4644    }
    4745
     
    217215        if (config->mode) { \
    218216            psError(PXTOOLS_ERR_CONFIG, true, "only one mode selection is allowed"); \
    219             goto FAIL; \
     217            psFree(config); \
     218            return NULL; \
    220219        } \
    221220        config->mode = modeval; \
     
    267266
    268267        psFree(argSets);
    269         goto FAIL;
     268        psFree(config);
     269        return NULL;
    270270    }
    271271
     
    280280        if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
    281281            psError(PXTOOLS_ERR_PROG, false, "failed to add item " #name); \
    282             goto FAIL; \
     282            psFree(config); \
     283            return NULL; \
    283284        } \
    284285    } \
     
    296297            if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
    297298                psError(PXTOOLS_ERR_PROG, false, "failed to add item camera");
    298                 goto FAIL;
     299                psFree(config);
     300                return NULL;
    299301            }
    300302        }
     
    308310            if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", imfiles)) {
    309311                psError(PXTOOLS_ERR_PROG, false, "failed to add item imfiles");
    310                 goto FAIL;
     312                psFree(config);
     313                return NULL;
    311314            }
    312315        }
     
    326329    if (!config->dbh) {
    327330        psError(PXTOOLS_ERR_SYS, false, "Can't configure database");
    328         goto FAIL;
     331        psFree(config);
     332        return NULL;
    329333    }
    330334
     
    333337    config->argc = argc;
    334338
    335 
    336339    return config;
    337 
    338 FAIL:
    339     // use the top-most error to determine the exit status
    340     exit_status = pxerrorGetExitStatus();
    341 
    342     psFree(config);
    343     pmConfigDone();
    344     psLibFinalize();
    345     exit(exit_status);
    346340}
Note: See TracChangeset for help on using the changeset viewer.