-const char actions_rcs[] = "$Id: actions.c,v 1.9 2001/07/30 22:08:36 jongfoster Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.10 2001/09/10 10:14:34 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
*
* Revisions :
* $Log: actions.c,v $
+ * Revision 1.10 2001/09/10 10:14:34 oes
+ * Removing unused variable
+ *
* Revision 1.9 2001/07/30 22:08:36 jongfoster
* Tidying up #defines:
* - All feature #defines are now of the form FEATURE_xxx
*
* Description : Copy an action_specs.
* Similar to "cur_action = new_action".
+ * Note that dest better not contain valid data
+ * - it's overwritten, not freed.
*
* Parameters :
* 1 : dest = Destination of copy.
{
int i;
+ memset(dest, '\0', sizeof(*dest));
+
dest->mask = src->mask;
dest->add = src->add;
*
* Function : free_action
*
- * Description : Free an action_specs.
+ * Description : Destroy an action_spec. Frees memory used by it,
+ * except for the memory used by the struct action_spec
+ * itself.
*
* Parameters :
* 1 : src = Source to free.
struct action_alias * alias_list,
struct action_spec *cur_action)
{
- memset(cur_action, '\0', sizeof(*cur_action));
+ init_action(cur_action);
cur_action->mask = ACTION_MASK_ALL;
while (line)
}
+/*********************************************************************
+ *
+ * Function : init_action
+ *
+ * Description : Zero out an action.
+ *
+ * Parameters :
+ * 1 : dest = An uninitialized action_spec.
+ *
+ * Returns : N/A
+ *
+ *********************************************************************/
+void init_action (struct action_spec *dest)
+{
+ memset(dest, '\0', sizeof(*dest));
+}
+
+
/*********************************************************************
*
* Function : merge_current_action
* is that this one doesn't allocate memory for
* strings (so "src" better be in memory for at least
* as long as "dest" is, and you'd better free
- * "dest" using "current_free_action").
+ * "dest" using "free_current_action").
* Also, there is no mask or remove lists in dest.
* (If we're applying it to a URL, we don't need them)
*
*
* Function : free_current_action
*
- * Description : Free a current_action_spec.
+ * Description : Free memory used by a current_action_spec.
+ * Does not free the current_action_spec itself.
*
* Parameters :
* 1 : src = Source to free.
{
next = cur->next;
free_url(cur->url);
+ free_action(cur->action);
freez(cur);
cur = next;
}
struct action_spec cur_action[1];
struct action_alias * alias_list = NULL;
- memset(cur_action, '\0', sizeof(*cur_action));
+ init_action(cur_action);
if (!check_file_changed(current_actions_file, csp->config->actions_file, &fs))
{
#ifndef ACTIONS_H_INCLUDED
#define ACTIONS_H_INCLUDED
-#define ACTIONS_H_VERSION "$Id: actions.h,v 1.1 2001/05/31 21:16:46 jongfoster Exp $"
+#define ACTIONS_H_VERSION "$Id: actions.h,v 1.2 2001/07/29 19:01:11 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.h,v $
*
* Revisions :
* $Log: actions.h,v $
+ * Revision 1.2 2001/07/29 19:01:11 jongfoster
+ * Changed _FILENAME_H to FILENAME_H_INCLUDED.
+ * Added forward declarations for needed structures.
+ *
* Revision 1.1 2001/05/31 21:16:46 jongfoster
* Moved functions to process the action list into this new file.
*
struct current_action_spec;
struct client_state;
-
+extern void init_action(struct action_spec *dest);
+extern void free_action(struct action_spec *src);
extern void merge_actions (struct action_spec *dest,
const struct action_spec *src);
extern void copy_action (struct action_spec *dest,
const struct action_spec *src);
-extern void free_action (struct action_spec *src);
extern char * actions_to_text (struct action_spec *action);
extern void init_current_action (struct current_action_spec *dest);
+extern void free_current_action (struct current_action_spec *src);
extern void merge_current_action (struct current_action_spec *dest,
const struct action_spec *src);
-extern void free_current_action (struct current_action_spec *src);
extern char * current_action_to_text(struct current_action_spec *action);
extern int get_action_token(char **line, char **name, char **value);