httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Gambarin <stanl...@cs.bu.edu>
Subject code cleanup
Date Mon, 21 Jul 1997 16:32:39 GMT


	There is a lot of occurrences of the code in the form
#if defined(STUFF) 
	some_func()
#endif
	which is really "not good" especially if some_func() is 
invoked multiple times.  One of the possible solutions is to change 
the above to following:

#if defined (STUFF)
some_func() 
{
	...
}
#else
#define some_func() /* nop */
#endif

	this reduces the amount of ifdef's in the code, with no penalties.
Diffs below attempt to do this for some of the STATUS defines.
							Stanley.


*** http_main.c	Mon Jul 21 00:00:35 1997
--- http_main.c.bak	Sun Jul 13 23:46:03 1997
  
      put_scoreboard_info(child_num, &new_score_rec); 
  }
- #else
- void time_process_request (int child_num, int status) /* nop */
- static void increment_counts (int child_num, request_rec *r) /* nop */
  #endif
  
  
--- 1211,1216 ----
***************
*** 2296,2302 ****
--- 2292,2301 ----
              (void)update_child_status(child_num, SERVER_BUSY_WRITE, r);
  
              process_request(r);
+ 
+ #if defined(STATUS)
              increment_counts(child_num, r);
+ #endif
  
              if (!current_conn->keepalive || current_conn->aborted) 
                  break;
***************
*** 3049,3055 ****
--- 3037,3046 ----
              (void)update_child_status(child_num, SERVER_BUSY_WRITE, r);
  
              process_request(r);
+ 
+ #if defined(STATUS)
              increment_counts(child_num, r);
+ #endif
  
              if (!current_conn->keepalive || current_conn->aborted)
                  break;

Mime
View raw message