Changeset 9947
- Timestamp:
- Nov 9, 2006, 6:05:00 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r9946 r9947 135 135 psAbort(argv[0], "invalid option (this should not happen)"); 136 136 } 137 psFree(config); pmConfigDone(); 137 138 psFree(config); 139 pmConfigDone(); 138 140 psLibFinalize(); 139 141 … … 832 834 if (psArrayLength(detRuns) != 1) { 833 835 psAbort(config->argv[0], "found more then one detRun matching det_id %d(this should not happen)", (psS32)atoi(det_id)); 834 return false; 836 return false; // unreachable 835 837 } 836 838 … … 858 860 } 859 861 if (exp_type) { 860 detRun->exp_type = exp_type; 862 psFree(detRun->exp_type); 863 detRun->exp_type = psStringCopy(exp_type); 861 864 } 862 865 … … 867 870 } 868 871 if (filter) { 869 detRun->filter = filter; 872 psFree(detRun->filter); 873 detRun->filter = psStringCopy(filter); 870 874 } 871 875 … … 912 916 } 913 917 if (object) { 914 detRun->object = object; 918 psFree(detRun->object); 919 detRun->object = psStringCopy(object); 915 920 } 916 921 … … 924 929 // pass through NULL as this is an optional field 925 930 if (registeredStr) { 926 psFree( registered);931 psFree(detRun->registered); 927 932 registered = psTimeFromISO(registeredStr, PS_TIME_UTC); 928 933 detRun->registered = psMemIncrRefCounter(registered); … … 940 945 // pass through NULL as this is an optional field 941 946 if (use_beginStr) { 942 psFree( use_begin);947 psFree(detRun->use_begin); 943 948 use_begin = psTimeFromISO(use_beginStr, PS_TIME_UTC); 944 949 detRun->use_begin = psMemIncrRefCounter(use_begin); … … 956 961 // pass through NULL as this is an optional field 957 962 if (use_endStr) { 958 psFree( use_end);963 psFree(detRun->use_end); 959 964 use_end = psTimeFromISO(use_endStr, PS_TIME_UTC); 960 965 detRun->use_end = psMemIncrRefCounter(use_end); … … 1015 1020 } 1016 1021 1017 {1018 1022 // print the new det_id 1019 psArray * detRuns = NULL;1023 psArray *newDetRuns = NULL; 1020 1024 { 1021 1025 psMetadata *where = psMetadataAlloc(); 1022 1026 psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", newDet_id); 1023 detRuns = psDBSelectRows(config->dbh, "detRun", where, 0);1027 newDetRuns = psDBSelectRows(config->dbh, "detRun", where, 0); 1024 1028 psFree(where); 1025 1029 } 1026 if (! detRuns) {1030 if (!newDetRuns) { 1027 1031 psError(PS_ERR_UNKNOWN, false, "can't find the detRun we just created"); 1028 1032 return false; 1029 1033 } 1030 1034 // sanity check the result... we should have only found one det_id 1031 if (psArrayLength( detRuns) != 1) {1035 if (psArrayLength(newDetRuns) != 1) { 1032 1036 psAbort(config->argv[0], "found more then one detRun matching det_id %ld(this should not happen)", newDet_id); 1033 return false; 1037 return false; // unreachable 1034 1038 } 1035 1039 1036 1040 // convert det_id to a string externaly 1037 if (!convertDetIdToStr( detRuns)) {1041 if (!convertDetIdToStr(newDetRuns)) { 1038 1042 psError(PS_ERR_UNKNOWN, false, "failed to convert det_id to a string"); 1039 psFree( detRuns);1043 psFree(newDetRuns); 1040 1044 return false; 1041 1045 } 1042 1046 1043 1047 // negative simple so the default is true 1044 if (!ippdbPrintMetadatas(stdout, detRuns, "detRun", !simple)) {1048 if (!ippdbPrintMetadatas(stdout, newDetRuns, "detRun", !simple)) { 1045 1049 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1046 psFree(detRuns); 1047 return false; 1048 } 1049 psFree(detRuns); 1050 } 1050 psFree(newDetRuns); 1051 return false; 1052 } 1053 psFree(newDetRuns); 1051 1054 1052 1055 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
