/[monit]/monit/gc.c
ViewVC logotype

Diff of /monit/gc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by hauk, Wed Jul 2 19:32:03 2003 UTC revision 1.22 by hauk, Sun Jul 20 01:24:58 2003 UTC
# Line 33  static void _gcpl(Service_T*); Line 33  static void _gcpl(Service_T*);
33  static void _gcpcl(Checksum_T*);  static void _gcpcl(Checksum_T*);
34  static void _gcpql(Resource_T*);  static void _gcpql(Resource_T*);
35  static void _gcppil(ProcInfo_T*);  static void _gcppil(ProcInfo_T*);
 static void _gcpdil(DeviceInfo_T*);  
36  static void _gcptl(Timestamp_T*);  static void _gcptl(Timestamp_T*);
37    static void _gccmd(Command_T *c);
38    static void _gcpdil(DeviceInfo_T*);
39  static void _gcpdl(Dependant_T *d);  static void _gcpdl(Dependant_T *d);
40    
41    
# Line 64  void gc() { Line 65  void gc() {
65    
66  void gc_service(Service_T *s) {  void gc_service(Service_T *s) {
67    
   int i;  
   
68    ASSERT(s&&*s);    ASSERT(s&&*s);
69        
70    if((*s)->portlist) {    if((*s)->portlist) {
# Line 121  void gc_service(Service_T *s) { Line 120  void gc_service(Service_T *s) {
120    free((*s)->group);    free((*s)->group);
121        
122    if((*s)->start) {    if((*s)->start) {
123      for(i= 0; (*s)->start->arg[i]; i++)      _gccmd(&(*s)->start);
         free((*s)->start->arg[i]);  
     free((*s)->start);  
124    }    }
125        
126    if((*s)->stop) {    if((*s)->stop) {
127      for(i= 0; (*s)->stop->arg[i]; i++)      _gccmd(&(*s)->stop);
         free((*s)->stop->arg[i]);  
     free((*s)->stop);  
128    }    }
129        
130    (*s)->next= NULL;    (*s)->next= NULL;
# Line 179  static void _gcpl(Service_T *s) { Line 174  static void _gcpl(Service_T *s) {
174  }  }
175    
176    
177    static void _gccmd(Command_T *c) {
178    
179      int i;
180      
181      ASSERT(c&&*c);
182      
183      for(i= 0; (*c)->arg[i]; i++)
184          free((*c)->arg[i]);
185      free(*c);
186      *c= NULL;
187    
188    }
189    
190    
191    
192  static void _gcppl(Port_T *s) {  static void _gcppl(Port_T *s) {
193        
194    ASSERT(s&&*s);    ASSERT(s&&*s);
# Line 229  static void _gcpql(Resource_T *q) { Line 239  static void _gcpql(Resource_T *q) {
239      _gcpql(&(*q)->next);      _gcpql(&(*q)->next);
240    
241    }    }
242      
243      if((*q)->exec) {
244        _gccmd(&(*q)->exec);
245      }
246    
247    free(*q);    free(*q);
248    *q= NULL;    *q= NULL;
# Line 267  static void _gcptl(Timestamp_T *p) { Line 281  static void _gcptl(Timestamp_T *p) {
281    }    }
282    
283    free((*p)->pathname);    free((*p)->pathname);
284      if((*p)->exec) {
285        _gccmd(&(*p)->exec);
286      }
287    free(*p);    free(*p);
288    *p= NULL;    *p= NULL;
289    

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26