-const char actions_rcs[] = "$Id: actions.c,v 1.10 2001/09/10 10:14:34 oes Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.11 2001/09/14 00:17:32 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/actions.c,v $
  *
  * Revisions   :
  *    $Log: actions.c,v $
+ *    Revision 1.11  2001/09/14 00:17:32  jongfoster
+ *    Tidying up memory allocation. New function init_action().
+ *
  *    Revision 1.10  2001/09/10 10:14:34  oes
  *    Removing unused variable
  *
       if (src->multi_remove_all[i])
       {
          /* Remove everything from dest */
-         destroy_list(dest->multi_remove[i]);
-         destroy_list(dest->multi_add[i]);
+         list_remove_all(dest->multi_remove[i]);
          dest->multi_remove_all[i] = 1;
+
          list_duplicate(dest->multi_add[i], src->multi_add[i]);
       }
       else if (dest->multi_remove_all[i])
                       *
                       * Remove *ALL*.
                       */
-                     destroy_list(remove);
-                     destroy_list(add);
+                     list_remove_all(remove);
+                     list_remove_all(add);
                      cur_action->multi_remove_all[action->index] = 1;
                   }
                   else
    unsigned mask = action->mask;
    unsigned add  = action->add;
    char * result = strdup("");
-   struct list * lst;
+   struct list_entry * lst;
 
    /* sanity - prevents "-feature +feature" */
    mask |= add;
    }                                                 \
    else                                              \
    {                                                 \
-      lst = action->multi_remove[__index]->next;     \
+      lst = action->multi_remove[__index]->first;    \
       while (lst)                                    \
       {                                              \
          result = strsav(result, " -" __name "{");   \
          lst = lst->next;                            \
       }                                              \
    }                                                 \
-   lst = action->multi_add[__index]->next;           \
+   lst = action->multi_add[__index]->first;          \
    while (lst)                                       \
    {                                                 \
       result = strsav(result, " +" __name "{");      \
 {
    unsigned flags  = action->flags;
    char * result = strdup("");
-   struct list * lst;
+   struct list_entry * lst;
 
 #define DEFINE_ACTION_BOOL(__name, __bit)   \
    if (flags & __bit)                       \
    }
 
 #define DEFINE_ACTION_MULTI(__name, __index)            \
-   lst = action->multi[__index]->next;                  \
+   lst = action->multi[__index]->first;                 \
    if (lst == NULL)                                     \
    {                                                    \
       result = strsav(result, " -" __name);             \
 void init_current_action (struct current_action_spec *dest)
 {
    memset(dest, '\0', sizeof(*dest));
+
    dest->flags = ACTION_MOST_COMPATIBLE;
 }
 
    {
       if (src->multi_remove_all[i])
       {
-         /* Remove everything from dest */
-         destroy_list(dest->multi[i]);
+         /* Remove everything from dest, then add src->multi_add */
          list_duplicate(dest->multi[i], src->multi_add[i]);
       }
       else
 
-const char filters_rcs[] = "$Id: filters.c,v 1.30 2001/09/16 11:00:10 jongfoster Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.31 2001/09/16 11:38:02 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/filters.c,v $
  *
  * Revisions   :
  *    $Log: filters.c,v $
+ *    Revision 1.31  2001/09/16 11:38:02  jongfoster
+ *    Splitting fill_template() into 2 functions:
+ *    template_load() loads the file
+ *    template_fill() performs the PCRS regexps.
+ *    This is because the CGI edit interface has a "table row"
+ *    template which is used many times in the page - this
+ *    change means it's only loaded from disk once.
+ *
  *    Revision 1.30  2001/09/16 11:00:10  jongfoster
  *    New function alloc_http_response, for symmetry with free_http_response
  *
    /*
     * Export the trust info, if available
     */
-   if (csp->config->trust_info->next)
+   if (csp->config->trust_info->first)
    {
-      struct list *l;
+      struct list_entry *l;
 
-      for (l = csp->config->trust_info->next; l ; l = l->next)
+      for (l = csp->config->trust_info->first; l ; l = l->next)
       {
          sprintf(buf, "<li> <a href=%s>%s</a><br>\n",l->str, l->str);
          p = strsav(p, buf);
 
-const char jcc_rcs[] = "$Id: jcc.c,v 1.37 2001/09/10 11:12:24 oes Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.38 2001/09/16 13:01:46 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.38  2001/09/16 13:01:46  jongfoster
+ *    Removing redundant function call that zeroed zalloc()'d memory.
+ *
  *    Revision 1.37  2001/09/10 11:12:24  oes
  *    Deleted unused variable
  *
     * vanilla wafer, then send the vanilla wafer.
     */
    if ((csp->config->jarfile != NULL)
-       && (csp->action->multi[ACTION_MULTI_WAFER]->next == NULL)
+       && list_is_empty(csp->action->multi[ACTION_MULTI_WAFER])
        && ((csp->action->flags & ACTION_VANILLA_WAFER) != 0))
    {
       enlist(csp->action->multi[ACTION_MULTI_WAFER], VANILLA_WAFER);
    /* We have a request. */
 
    hdr = sed(client_patterns, add_client_headers, csp);
-   destroy_list(csp->headers);
+   list_remove_all(csp->headers);
 
    /* 
     * Now, check to see if we need to intercept it, i.e.
 
-const char parsers_rcs[] = "$Id: parsers.c,v 1.23 2001/09/12 18:08:19 steudten Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.24 2001/09/13 23:05:50 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
  *
  * Revisions   :
  *    $Log: parsers.c,v $
+ *    Revision 1.24  2001/09/13 23:05:50  jongfoster
+ *    Changing the string paramater to the header parsers a "const".
+ *
  *    Revision 1.23  2001/09/12 18:08:19  steudten
  *
  *    In parse_http_request() header rewriting miss the host value, so
  *********************************************************************/
 char *sed(const struct parsers pats[], void (* const more_headers[])(struct client_state *), struct client_state *csp)
 {
-   struct list *p;
+   struct list_entry *p;
    const struct parsers *v;
    char *hdr;
    void (* const *f)();
 
    for (v = pats; v->str ; v++)
    {
-      for (p = csp->headers->next; p ; p = p->next)
+      for (p = csp->headers->first; p ; p = p->next)
       {
          /* Header crunch()ed in previous run? -> ignore */
          if (p->str == NULL) continue;
          if (strncmpic(p->str, v->str, v->len) == 0)
          {
             hdr = v->parser(v, p->str, csp);
-            freez(p->str);
+            freez((char *)p->str); /* FIXME: Yuck! patching a list...*/
             p->str = hdr;
          }
       }
  *********************************************************************/
 void client_cookie_adder(struct client_state *csp)
 {
-   struct list *lst;
+   struct list_entry *lst;
    char *tmp = NULL;
    char *e;
 
-   for (lst = csp->cookie_list->next; lst ; lst = lst->next)
+   for (lst = csp->cookie_list->first; lst ; lst = lst->next)
    {
       if (tmp)
       {
       tmp = strsav(tmp, lst->str);
    }
 
-   for (lst = csp->action->multi[ACTION_MULTI_WAFER]->next;  lst ; lst = lst->next)
+   for (lst = csp->action->multi[ACTION_MULTI_WAFER]->first;  lst ; lst = lst->next)
    {
       if (tmp)
       {
  *********************************************************************/
 void client_xtra_adder(struct client_state *csp)
 {
-   struct list *lst;
+   struct list_entry *lst;
 
-   for (lst = csp->action->multi[ACTION_MULTI_ADD_HEADER]->next;
+   for (lst = csp->action->multi[ACTION_MULTI_ADD_HEADER]->first;
         lst ; lst = lst->next)
    {
       log_error(LOG_LEVEL_HEADER, "addh: %s", lst->str);