Changeset 38502
- Timestamp:
- Jun 19, 2015, 3:11:47 PM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150616/Ohana/src/dvomerge
- Files:
-
- 8 edited
-
include/dvomerge.h (modified) (4 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/args.c (modified) (3 diffs)
-
src/dvo_image_merge_dbs.c (modified) (1 diff)
-
src/dvomerge.c (modified) (2 diffs)
-
src/dvomergeHistory.c (modified) (8 diffs)
-
src/dvomergeImageIDs.c (modified) (3 diffs)
-
src/dvomergeUpdate.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/include/dvomerge.h
r38497 r38502 116 116 void dvomerge_help PROTO((int argc, char **argv)); 117 117 int dvomerge_args PROTO((int *argc, char **argv)); 118 void dvomerge_args_free PROTO((void)); 118 119 119 120 void dvomerge_client_usage PROTO((void)); … … 175 176 int dvo_update_image_IDs PROTO((IDmapType *IDmap, Catalog *catalog)); 176 177 void dvo_image_map_free PROTO((IDmapType *IDmap)); 178 void dvo_image_map_init PROTO((IDmapType *IDmap)); 177 179 178 180 // dvorepair prototypes … … 213 215 int dmhObjectCheck (dmhObject *history, dmhObjectStats *inStats); 214 216 dmhObject *dmhObjectRead (char *filename); 217 dmhObject *dmhObjectAlloc (void); 218 void dmhObjectFree (dmhObject *history); 215 219 216 220 void dmhObjectStatsFree (dmhObjectStats *stats); … … 218 222 219 223 int dmhImageAdd (FITS_DB *db, dmhImage *history, char *dbID); 220 dmhImage *dmhImageRead (FITS_DB *db) ;224 dmhImage *dmhImageRead (FITS_DB *db); 221 225 int dmhImageCheck (dmhImage *history, char *dbID); 226 void dmhImageFree(dmhImage *history); 222 227 223 228 char *dmhImageReadID (FITS_DB *db); -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/ConfigInit.c
r27435 r38502 47 47 VERBOSE = TRUE; 48 48 49 FreeConfigFile(); 49 50 free (config); 50 51 free (file); -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/args.c
r38468 r38502 6 6 int N; 7 7 8 HOSTDIR = NULL; 9 SINGLE_CPT = NULL; 10 8 11 /* extra error messages */ 9 12 VERBOSE = FALSE; … … 53 56 54 57 /* use a different photcode file to define mean values */ 58 ALTERNATE_PHOTCODE_FILE = NULL; 55 59 if ((N = get_argument (*argc, argv, "-photcode-file"))) { 56 60 remove_argument (N, argc, argv); … … 156 160 } 157 161 162 void dvomerge_args_free (void) { 163 FREE (HOSTDIR); 164 FREE (ALTERNATE_PHOTCODE_FILE); 165 FREE (UPDATE_CATFORMAT); 166 FREE (UPDATE_CATCOMPRESS); 167 FREE (SINGLE_CPT); 168 } 169 158 170 /*** check for command line options ***/ 159 171 int dvomerge_client_args (int *argc, char **argv) { -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
r38497 r38502 6 6 off_t getTgtIndex (e_time start, e_time stop, short photcode, off_t *TgtIndex, e_time *TgtTimes, short *TgtCodes, off_t NimagesTgt); 7 7 8 void dvo_image_map_init (IDmapType *IDmap) { 9 // we don't own the IDmap, just the elements 10 IDmap->old = NULL; 11 IDmap->new = NULL; 12 IDmap->notFound = NULL; 13 IDmap->Nmap = 0; 14 } 15 8 16 void dvo_image_map_free (IDmapType *IDmap) { 9 17 // we don't own the IDmap, just the elements 10 free(IDmap->old);11 free (IDmap->old);12 free(IDmap->notFound);18 FREE (IDmap->old); 19 FREE (IDmap->new); 20 FREE (IDmap->notFound); 13 21 } 14 22 -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/dvomerge.c
r35765 r38502 7 7 ConfigInit (&argc, argv); 8 8 dvomerge_args (&argc, argv); 9 10 if ((argc < 4) || (argc > 6)) dvomerge_usage(); 9 11 10 12 if (argc == 6) { … … 38 40 } 39 41 } 40 dvomerge_usage(); 41 exit (2); // cannot reach here. 42 dvomerge_args_free (); 43 ohana_memcheck (TRUE); 44 ohana_memdump (TRUE); 45 exit (0); 42 46 } 43 47 -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/dvomergeHistory.c
r34578 r38502 28 28 char *ID = strcreate (dbID); 29 29 return ID; 30 } 31 32 void dmhImageFree(dmhImage *history) { 33 if (!history) return; 34 35 int i; 36 for (i = 0; i < history->Nmerge; i++) { 37 FREE (history->IDs[i]); 38 } 39 FREE (history->IDs); 40 FREE (history); 30 41 } 31 42 … … 125 136 } 126 137 138 dmhObject *dmhObjectAlloc (void) { 139 140 dmhObject *history = NULL; 141 ALLOCATE (history, dmhObject, 1); 142 history->Nmerge = 0; 143 144 // ALLOCATE full list 145 ALLOCATE (history->size, off_t, history->Nmerge); 146 ALLOCATE (history->time, time_t, history->Nmerge); 147 ALLOCATE (history->date, char *, history->Nmerge); 148 return history; 149 } 150 151 void dmhObjectFree (dmhObject *history) { 152 if (!history) return; 153 154 FREE (history->size); 155 FREE (history->time); 156 157 if (history->date) { 158 int i; 159 for (i = 0; i < history->Nmerge; i++) { 160 FREE (history->date[i]); 161 } 162 } 163 FREE (history->date); 164 FREE (history); 165 return; 166 } 167 127 168 // read the array of merged history information from this file's header 128 169 dmhObject *dmhObjectRead (char *filename) { … … 133 174 if (stat_result) { 134 175 if (errno == ENOENT) { 135 dmhObject *history = NULL; 136 ALLOCATE (history, dmhObject, 1); 137 history->Nmerge = 0; 138 139 // ALLOCATE full list 140 ALLOCATE (history->size, off_t, history->Nmerge); 141 ALLOCATE (history->time, time_t, history->Nmerge); 142 ALLOCATE (history->date, char *, history->Nmerge); 176 dmhObject *history = dmhObjectAlloc(); 143 177 return history; 144 178 } … … 162 196 fclose (fout); 163 197 164 dmhObject *history = NULL; 165 ALLOCATE (history, dmhObject, 1); 198 dmhObject *history = dmhObjectAlloc(); 166 199 167 200 int status = gfits_scan (&outheader, "NMERGE", "%d", 1, &history->Nmerge); … … 171 204 172 205 // ALLOCATE full list 173 ALLOCATE (history->size, off_t, history->Nmerge);174 ALLOCATE (history->time, time_t, history->Nmerge);175 ALLOCATE (history->date, char *, history->Nmerge);206 REALLOCATE (history->size, off_t, history->Nmerge); 207 REALLOCATE (history->time, time_t, history->Nmerge); 208 REALLOCATE (history->date, char *, history->Nmerge); 176 209 177 210 int i; … … 199 232 history->time[i] = ohana_date_to_sec (date); 200 233 } 234 gfits_free_header (&outheader); 201 235 return history; 202 236 } … … 239 273 history->size[last] = inStats->size; 240 274 history->time[last] = inStats->time; 241 history->date[last] = inStats->date;275 history->date[last] = strcreate (inStats->date); 242 276 243 277 char name[16]; … … 280 314 int i; 281 315 for (i = 0; i < N; i++) { 282 if (outstat[i].history) { free (outstat[i].history); }316 if (outstat[i].history) { dmhObjectFree (outstat[i].history); } 283 317 if (outstat[i].filename) { free (outstat[i].filename); } 284 318 } -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/dvomergeImageIDs.c
r38497 r38502 64 64 dvo_image_match_dbs(IDmap, &outDB, &inDB); 65 65 dvo_image_unlock (&outDB); // unlock output 66 67 gfits_db_free (&inDB); 68 gfits_db_free (&outDB); 69 dmhImageFree (history); 70 FREE (indbID); 66 71 return TRUE; 67 72 } … … 81 86 dvo_image_unlock (&outDB); // unlock output 82 87 83 gfits_db_free (inDB); 84 gfits_db_free (outDB); 88 gfits_db_free (&inDB); 89 gfits_db_free (&outDB); 90 91 dmhImageFree (history); 92 FREE (indbID); 85 93 86 94 return TRUE; … … 139 147 dvo_image_match_dbs(IDmap, &outDB, &inDB); 140 148 141 gfits_db_free ( inDB);142 gfits_db_free ( outDB);149 gfits_db_free (&inDB); 150 gfits_db_free (&outDB); 143 151 144 152 return TRUE; -
branches/eam_branches/ipp-20150616/Ohana/src/dvomerge/src/dvomergeUpdate.c
r38497 r38502 8 8 char filename[256], *input, *output; 9 9 IDmapType IDmap; 10 PhotCodeData *inputPhotcodes;11 PhotCodeData *outputPhotcodes;12 10 int *secfiltMap = NULL; 13 11 int NsecfiltInput, NsecfiltOutput; 14 12 15 13 INITTIME; 14 15 dvo_image_map_init (&IDmap); 16 16 17 17 CONTINUE = FALSE; … … 34 34 exit (1); 35 35 } 36 37 PhotCodeData *inputPhotcodes = NULL; 38 PhotCodeData *outputPhotcodes = NULL; 36 39 37 40 SetPhotcodeTable(NULL); … … 112 115 113 116 int status = dvomergeUpdate_catalogs (input, output, outsky, inlist, NsecfiltInput, NsecfiltOutput, &IDmap, secfiltMap); 114 dvo_image_map_free (&IDmap);115 117 116 118 // save the output sky table copy … … 121 123 exit (1); 122 124 } 125 FREE (skyfile); 123 126 124 ohana_memcheck (TRUE); 127 SkyTableFree (insky); 128 SkyTableFree (outsky); 129 SkyListFree (inlist); 130 131 FREE (secfiltMap); 132 dvo_image_map_free (&IDmap); 133 if (outputPhotcodes != inputPhotcodes) { FreePhotcodeData (outputPhotcodes); } 134 FreePhotcodeData (inputPhotcodes); 135 FreePhotcodeTable (); 125 136 126 137 if (!status) { … … 130 141 131 142 MARKTIME ("SUCCESS: elapsed time %9.4f sec\n", dtime); 132 exit (0);143 return TRUE; 133 144 }
Note:
See TracChangeset
for help on using the changeset viewer.
