monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dependecies


From: Jan-Henrik Haukeland
Subject: Re: Dependecies
Date: 21 Sep 2002 19:41:37 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service)

Rory Toma <address@hidden> writes:

> There is a lot of redundancy in stop and start.c.
> 
> After I get this dependency stuff done, I think I'm going to combine
> start and stop into one function. It becomes much more apparent when
> doing multiple actions...

Your right and it's a _good_ idea to refactor and combine the code,
but keep the function prototypes start_xyyz and stop_xyyz (except for
the dstart/dstop which you can combine). The reason is that we someday
could need to differ the two function sets. The function design in
alert is a good idea. That is, you use a couple of short functions
that call a big function that does the actuall work. For instance:

start_process(Process_T p) {

  do_action(p, DO_START_PROCESS);

}

stop_process(Process_T p) {

  do_action(p, DO_STOP_PROCESS);

}

and

do_action(Process_T p, int action) {

 switch(action) {
 
  case DO_STOP_PROCESS:  ..
  case DO_START_PROCESS: ..

 }

}

This means that you should probably combine the start.c and stop.c
files into one action.c file?


-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]