Changeset 11842
- Timestamp:
- Feb 15, 2007, 3:52:15 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
regtool.c (modified) (2 diffs)
-
regtoolConfig.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r11816 r11842 56 56 int main(int argc, char **argv) 57 57 { 58 psExit exit_status = PS_EXIT_SUCCESS;59 60 58 psLibInit(NULL); 61 59 62 60 pxConfig *config = p0toolConfig(NULL, argc, argv); 61 if (!config) { 62 psError(PXTOOLS_ERR_CONFIG, false, "failed to configure"); 63 goto FAIL; 64 } 63 65 64 66 switch (config->mode) { … … 79 81 psLibFinalize(); 80 82 81 exit( exit_status);83 exit(EXIT_SUCCESS); 82 84 83 85 FAIL: 84 // use the top-most error to determine the exit status85 exit_status = pxerrorGetExitStatus();86 psErrorStackPrint(stderr, "\n"); 87 int exit_status = pxerrorGetExitStatus(); 86 88 87 89 psFree(config); 88 90 pmConfigDone(); 89 psErrorStackPrint(stderr, "\n");90 91 psLibFinalize(); 91 92 -
trunk/ippTools/src/regtoolConfig.c
r11702 r11842 28 28 #include "p0tool.h" 29 29 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 30 pxConfig *p0toolConfig(pxConfig *config, int argc, char **argv) 31 { 35 32 if (!config) { 36 33 config = pxConfigAlloc(); … … 43 40 if (!config->modules) { 44 41 psError(PXTOOLS_ERR_CONFIG, false, "Can't find site configuration"); 45 goto FAIL; 42 psFree(config); 43 return NULL; 46 44 } 47 45 … … 217 215 if (config->mode) { \ 218 216 psError(PXTOOLS_ERR_CONFIG, true, "only one mode selection is allowed"); \ 219 goto FAIL; \ 217 psFree(config); \ 218 return NULL; \ 220 219 } \ 221 220 config->mode = modeval; \ … … 267 266 268 267 psFree(argSets); 269 goto FAIL; 268 psFree(config); 269 return NULL; 270 270 } 271 271 … … 280 280 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\ 281 281 psError(PXTOOLS_ERR_PROG, false, "failed to add item " #name); \ 282 goto FAIL; \ 282 psFree(config); \ 283 return NULL; \ 283 284 } \ 284 285 } \ … … 296 297 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) { 297 298 psError(PXTOOLS_ERR_PROG, false, "failed to add item camera"); 298 goto FAIL; 299 psFree(config); 300 return NULL; 299 301 } 300 302 } … … 308 310 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "imfiles", 0, "==", imfiles)) { 309 311 psError(PXTOOLS_ERR_PROG, false, "failed to add item imfiles"); 310 goto FAIL; 312 psFree(config); 313 return NULL; 311 314 } 312 315 } … … 326 329 if (!config->dbh) { 327 330 psError(PXTOOLS_ERR_SYS, false, "Can't configure database"); 328 goto FAIL; 331 psFree(config); 332 return NULL; 329 333 } 330 334 … … 333 337 config->argc = argc; 334 338 335 336 339 return config; 337 338 FAIL:339 // use the top-most error to determine the exit status340 exit_status = pxerrorGetExitStatus();341 342 psFree(config);343 pmConfigDone();344 psLibFinalize();345 exit(exit_status);346 340 }
Note:
See TracChangeset
for help on using the changeset viewer.
