Changeset 5451 for trunk/Ohana/src/opihi/dvo/dmags.c
- Timestamp:
- Oct 27, 2005, 7:10:17 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/dmags.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/dmags.c
r5320 r5451 3 3 int dmags (int argc, char **argv) { 4 4 5 char filename[256], catdir[256],*RegionName, *RegionList;5 char *RegionName, *RegionList; 6 6 double *M1, *M3; 7 7 int i, j, m, i1, i3, N1, N3, N; 8 8 int Npts, NPTS, mode[3]; 9 int Nsec, Nregions,KeepNulls;9 int Nsec, KeepNulls; 10 10 11 11 PhotCode *code[3]; 12 12 Catalog catalog; 13 RegionFile *regions;13 SkyList *skylist; 14 14 Vector *xvec, *yvec; 15 15 16 16 /* defaults */ 17 regions = NULL;18 17 catalog.average = NULL; 19 18 catalog.secfilt = NULL; … … 25 24 if (!InitPhotcodes ()) goto escape; 26 25 Nsec = GetPhotcodeNsecfilt (); 27 28 /* find CATDIR in config system */29 if (VarConfig ("CATDIR", "%s", catdir) == NULL) goto escape;30 26 31 27 /* interpret command-line options */ … … 49 45 50 46 /* load region corresponding to selection above */ 51 if (( regions = SelectRegions (RegionName, RegionList, &Nregions)) == NULL) goto escape;47 if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape; 52 48 53 49 /* init vectors to save data */ … … 58 54 59 55 /* loop over regions, extract data for each region */ 60 for (j = 0; j < Nregions; j++) {56 for (j = 0; j < skylist[0].Nregions; j++) { 61 57 /* lock, load, unlock catalog */ 62 sprintf (filename, "%s/%s", catdir, regions[j].name); 63 catalog.filename = filename; 58 catalog.filename = (char *) skylist[0].regions[j][0].filename; 64 59 switch (lock_catalog (&catalog, LCK_SOFT)) { 65 60 case 2: … … 119 114 catalog.measure = (Measure *) NULL; 120 115 } 121 if (regions != NULL) free (regions); 116 117 /* need to free SkyList / or free all regions as well */ 118 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 122 119 xvec[0].Nelements = yvec[0].Nelements = Npts; 123 120 return (TRUE); … … 132 129 133 130 escape: 134 if (regions != NULL) free (regions);131 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); 135 132 if (catalog.average != NULL) free (catalog.average); 136 133 if (catalog.secfilt != NULL) free (catalog.secfilt);
Note:
See TracChangeset
for help on using the changeset viewer.
