Commit 0bae13dd authored by Paul Querna's avatar Paul Querna
Browse files

Improve ability to compile on C90 Compilers.

* Move all variable declartions to the top of their blocks.
* Remove traiing comma on enum
* Only use C90 style comments.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@708813 13f79535-47bb-0310-9956-ffa450edef68
parent 31c91bb4
Loading
Loading
Loading
Loading
+11 −5
Changes for server/mpm/simple/simple_api.c: 11 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -121,9 +121,11 @@ simple_open_logs(apr_pool_t *p,
                 apr_pool_t *ptemp,
                 server_rec *s)
{
  int nsock;

  ap_server_conf = s;
  
  int nsock = ap_setup_listeners(s);
  nsock = ap_setup_listeners(s);

  if (nsock < 1) {
    ap_log_error(APLOG_MARK, APLOG_ALERT, 0,
@@ -139,12 +141,13 @@ static int
simple_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
                  apr_pool_t *ptemp)
{
  int run_debug;
  apr_status_t rv;
  simple_core_t* sc = simple_core_get();

  sc->restart_num++;

  int run_debug = ap_exists_config_define("DEBUG");
  run_debug = ap_exists_config_define("DEBUG");

  if (run_debug) {
    sc->run_foreground = 1;
@@ -262,12 +265,14 @@ set_proccount(cmd_parms *cmd, void *baton, const char *arg)
static const char*
set_threadcount(cmd_parms *cmd, void *baton, const char *arg)
{
  simple_core_t *sc = simple_core_get();
  const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);

  if (err != NULL) {
    return err;
  }

  simple_core_get()->procmgr.thread_count = atoi(arg);
  sc->procmgr.thread_count = atoi(arg);

  return NULL;
}
@@ -275,13 +280,14 @@ set_threadcount(cmd_parms *cmd, void *baton, const char *arg)
static const char*
set_user(cmd_parms *cmd, void *baton, const char *arg)
{
  simple_core_t *sc = simple_core_get();
  const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  if (err != NULL) {
    return err;
  }
  
  simple_core_get()->procmgr.user_name = arg;
  simple_core_get()->procmgr.user_id = ap_uname2id(arg);
  sc->procmgr.user_name = arg;
  sc->procmgr.user_id = ap_uname2id(arg);

  return NULL;
}
+4 −3
Changes for server/mpm/simple/simple_children.c: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -53,13 +53,14 @@ void
simple_check_children_size(simple_core_t *sc,
                           void *baton)
{
  unsigned int count;
  int wanted;
  int i;
  
  simple_register_timer(sc,
                        simple_check_children_size,
                        NULL,
                        SPAWN_CHILDREN_INTERVAL);
  unsigned int count;
  int wanted;
  int i;

  if (sc->run_single_process && sc->restart_num == 2) {
    static int run = 0;
+1 −1
Changes for server/mpm/simple/simple_event.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

//#define APR_RING_DEBUG 1
/* #define APR_RING_DEBUG 1 */

#include "simple_types.h"
#include "simple_event.h"
+14 −9
Changes for server/mpm/simple/simple_io.c: 14 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -47,6 +47,9 @@ static apr_status_t
simple_io_process(simple_conn_t *scon)
{
  apr_status_t rv;
  simple_core_t *sc;
  conn_rec *c;
  conn_state_t *cs;

  if (scon->c->clogging_input_filters && !scon->c->aborted) {
    /* Since we have an input filter which 'cloggs' the input stream,
@@ -59,9 +62,9 @@ simple_io_process(simple_conn_t *scon)
    }
  }

  simple_core_t *sc = scon->sc;
  conn_rec *c = scon->c;
  conn_state_t *cs = c->cs;
  sc = scon->sc;
  c = scon->c;
  cs = c->cs;

  while (!c->aborted) {
    if (cs->state == CONN_STATE_READ_REQUEST_LINE) {
@@ -175,12 +178,14 @@ static void *
simple_io_setup_conn(apr_thread_t* thread, void *baton)
{
  apr_status_t rv;
  ap_sb_handle_t *sbh;
  conn_state_t *cs;
  long conn_id = 0;
  simple_sb_t *sb;
  simple_conn_t *scon = (simple_conn_t *)baton;

  /* pqXXXXX: remove this. */
  ap_sb_handle_t *sbh;
  ap_create_sb_handle(&sbh, scon->pool, 0, 0);
  long conn_id = 0;

  scon->ba = apr_bucket_alloc_create(scon->pool);

@@ -188,8 +193,8 @@ simple_io_setup_conn(apr_thread_t* thread, void *baton)
                               conn_id, sbh, scon->ba);

  scon->c->cs = apr_pcalloc(scon->pool, sizeof(conn_state_t));
  conn_state_t *cs = scon->c->cs;
  simple_sb_t *sb = apr_pcalloc(scon->pool, sizeof(simple_sb_t));
  cs = scon->c->cs;
  sb = apr_pcalloc(scon->pool, sizeof(simple_sb_t));

  cs->pfd.p = scon->pool;
  cs->pfd.desc_type = APR_POLL_SOCKET;
@@ -225,12 +230,12 @@ apr_status_t
simple_io_accept(simple_core_t *sc, simple_sb_t *sb)
{
  apr_status_t rv;
  ap_listen_rec *lr = (ap_listen_rec *)sb->baton;
  apr_pool_t *ptrans;
  apr_socket_t *socket;
  ap_listen_rec *lr = (ap_listen_rec *)sb->baton;

  /* pqXXXXXX: Consider doing pool recycling like the event/worker MPMs do. */
  apr_pool_create(&ptrans, NULL);
  apr_socket_t *socket;

  apr_pool_tag(ptrans, "transaction");

+13 −8
Changes for server/mpm/simple/simple_run.c: 13 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

//#define APR_RING_DEBUG 1
/* #define APR_RING_DEBUG 1 */

#include "httpd.h"
#include "http_log.h"
@@ -158,20 +158,26 @@ simple_run_loop(simple_core_t *sc)
  simple_timer_t *ep = NULL;
  
  while (sc->mpm_state == AP_MPMQ_RUNNING) {
    apr_time_t now = apr_time_now();
    apr_time_t tnow = apr_time_now();
    simple_timer_t *head;
    apr_interval_time_t timeout = apr_time_from_msec(500);
    APR_RING_HEAD(simple_temp_timer_ring_t, simple_timer_t) tmp_ring;

    apr_thread_mutex_lock(sc->mtx);
    simple_timer_t *head = APR_RING_FIRST(&sc->timer_ring);
    head = APR_RING_FIRST(&sc->timer_ring);
    
    if (head != APR_RING_SENTINEL(&sc->timer_ring, simple_timer_t, link)) {
      if (now < head->expires) {
        timeout = (head->expires - now);
      if (tnow < head->expires) {
        timeout = (head->expires - tnow);
        if (timeout > apr_time_from_msec(500)) {
          /* pqXXXXX: I'm 95% sure that the Linux Powertop guys will slap me for this. */
          timeout = apr_time_from_msec(500);
        }
      }
      else {
        /* We have already expired timers in the queue. */
        timeout = 0;
      }
    }
    apr_thread_mutex_unlock(sc->mtx);

@@ -180,7 +186,7 @@ simple_run_loop(simple_core_t *sc)
                         simple_io_callback,
                         sc);

    now = apr_time_now();
    tnow = apr_time_now();

    if (rv) {
      if (!APR_STATUS_IS_EINTR(rv) && !APR_STATUS_IS_TIMEUP(rv)) {
@@ -190,7 +196,6 @@ simple_run_loop(simple_core_t *sc)
      }
    }
    
    APR_RING_HEAD(simple_temp_timer_ring_t, simple_timer_t) tmp_ring;
    APR_RING_INIT(&tmp_ring, simple_timer_t, link);

    apr_thread_mutex_lock(sc->mtx);
@@ -204,7 +209,7 @@ simple_run_loop(simple_core_t *sc)
                                   simple_timer_t, link);
           ep = APR_RING_NEXT(ep, link))
      {
        if (ep->expires < now) {
        if (ep->expires < tnow) {
          simple_timer_t *next = APR_RING_PREV(ep, link);
          /* push this task */
          APR_RING_REMOVE(ep, link);
Loading