pcs         98/02/06 10:19:57

  Modified:    src/main http_config.c
  Log:
  Add an API function remove_module() to remove a module structure from the
  linked list of module structures. This is called by the dynamic module
  modules (mod_dll, mod_so) when a module is unloaded. This should only ever
  be called during a restart since it invalidates per-dir and per-server
  vectors.
  
  Revision  Changes    Path
  1.96      +42 -0     apache-1.3/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- http_config.c     1998/02/02 22:33:31     1.95
  +++ http_config.c     1998/02/06 18:19:56     1.96
  @@ -530,6 +530,48 @@
       build_method_shortcuts();
   }
   
  +/* 
  + * remove_module undoes what add_module did. There are some caveats:
  + * when the module is removed, its slot is lost so all the current
  + * per-dir and per-server configurations are invalid. So we should
  + * only ever call this function when you are invalidating almost
  + * all our current data. I.e. when doing a restart.
  + */
  +
  +API_EXPORT(void) remove_module(module *m)
  +{
  +    module *modp;
  +
  +    modp = top_module;
  +    if (modp == m) {
  +     /* We are the top module, special case */
  +     top_module = modp->next;
  +    }
  +    else {
  +     /* Not the top module, find use. When found modp will
  +      * point to the module _before_ us in the list
  +      */
  +
  +     while (modp && modp->next != m) {
  +         modp = modp->next;
  +     }
  +     if (!modp) {
  +         /* Uh-oh, this module doesn't exist */
  +         aplog_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, NULL,
  +             "Cannot remove module %s: not found in module list",
  +             m->name);
  +         return;
  +     }
  +     /* Eliminate us from the module list */
  +     modp->next = modp->next->next;
  +    }
  +
  +    m->module_index = -1;    /* simulate being unloaded, should
  +                              * be unnecessary */
  +    dynamic_modules--;
  +}
  +
  +
   void setup_prelinked_modules()
   {
       module **m;
  
  
  

Reply via email to