Changeset 11856
- Timestamp:
- Feb 16, 2007, 12:21:42 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
detselect.c (modified) (2 diffs)
-
detselectConfig.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/detselect.c
r11713 r11856 42 42 43 43 pxConfig *config = detselectConfig(NULL, argc, argv); 44 if (!config) { 45 psError(PXTOOLS_ERR_CONFIG, false, "failed to configure"); 46 goto FAIL; 47 } 44 48 45 49 switch (config->mode) { … … 57 61 58 62 FAIL: 63 psErrorStackPrint(stderr, "\n"); 64 int exit_status = pxerrorGetExitStatus(); 65 59 66 psFree(config); 60 67 pmConfigDone(); 61 psErrorStackPrint(stderr, "\n");62 68 psLibFinalize(); 63 69 64 exit( EXIT_FAILURE);70 exit(exit_status); 65 71 } 66 72 -
trunk/ippTools/src/detselectConfig.c
r11702 r11856 28 28 #include "detselect.h" 29 29 30 // this function can not fail -- exits on error 31 pxConfig *detselectConfig(pxConfig *config, int argc, char **argv){30 pxConfig *detselectConfig(pxConfig *config, int argc, char **argv) 31 { 32 32 if (!config) { 33 33 config = pxConfigAlloc(); … … 40 40 if (!config->modules) { 41 41 psError(PS_ERR_UNKNOWN, false, "Can't find site configuration"); 42 goto FAIL; 42 psFree(config); 43 return NULL; 43 44 } 44 45 … … 84 85 if (config->mode) { \ 85 86 psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); \ 86 goto FAIL; \ 87 psFree(config); \ 88 return NULL; \ 87 89 } \ 88 90 config->mode = modeval; \ … … 126 128 127 129 psFree(argSets); 128 goto FAIL; 130 psFree(config); 131 return NULL; 129 132 } 130 133 … … 139 142 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\ 140 143 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \ 141 goto FAIL; \ 144 psFree(config); \ 145 return NULL; \ 142 146 } \ 143 147 } \ … … 151 155 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, #name, 0, "==", s32)) { \ 152 156 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \ 153 goto FAIL; \ 157 psFree(config); \ 158 return NULL; \ 154 159 } \ 155 160 } \ … … 164 169 if (!psMetadataAddF32(config->where, PS_LIST_TAIL, #name, 0, "==", var)) { \ 165 170 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \ 166 goto FAIL; \ 171 psFree(config); \ 172 return NULL; \ 167 173 } \ 168 174 } \ … … 178 184 if (!psMetadataAddF64(config->where, PS_LIST_TAIL, #name, 0, "==", var)) { \ 179 185 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \ 180 goto FAIL; \ 186 psFree(config); \ 187 return NULL; \ 181 188 } \ 182 189 } \ … … 192 199 if (!time) { \ 193 200 psError(PS_ERR_UNKNOWN, false, "failed to convert " #name " into a psTime object"); \ 194 goto FAIL; \ 201 psFree(config); \ 202 return NULL; \ 195 203 } \ 196 204 psMetadataItem *item = psMetadataLookup(config->args, "-" #name); \ … … 202 210 if (!psMetadataAddTime(config->where, PS_LIST_TAIL, #name, 0, str, time)) {\ 203 211 psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \ 204 goto FAIL; \ 212 psFree(config); \ 213 return NULL; \ 205 214 } \ 206 215 psFree(time); \ … … 221 230 if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) { 222 231 psError(PS_ERR_UNKNOWN, false, "failed to add item camera"); 223 goto FAIL; 232 psFree(config); 233 return NULL; 224 234 } 225 235 } … … 248 258 if (!config->dbh) { 249 259 psError(PS_ERR_UNKNOWN, false, "Can't configure database"); 250 goto FAIL; 260 psFree(config); 261 return NULL; 251 262 } 252 263 … … 256 267 257 268 return config; 258 259 FAIL: 260 psFree(config); 261 pmConfigDone(); 262 psLibFinalize(); 263 264 exit(EXIT_FAILURE); 265 } 269 }
Note:
See TracChangeset
for help on using the changeset viewer.
