X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=actions.c;h=e4e5aaf2f14bb85efec7654337ccd8f23e22fdd2;hp=3fe17cb2718538812fc13d9ccacc4c432952b59c;hb=c86684396af6e5e52675ffe8ec43468269588ea7;hpb=014e796377eafac5f1875e61282d48cb337dbdce diff --git a/actions.c b/actions.c index 3fe17cb2..e4e5aaf2 100644 --- a/actions.c +++ b/actions.c @@ -1,4 +1,4 @@ -const char actions_rcs[] = "$Id: actions.c,v 1.2 2001/05/31 21:40:00 jongfoster Exp $"; +const char actions_rcs[] = "$Id: actions.c,v 1.7 2001/06/09 10:55:28 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/actions.c,v $ @@ -33,6 +33,23 @@ const char actions_rcs[] = "$Id: actions.c,v 1.2 2001/05/31 21:40:00 jongfoster * * Revisions : * $Log: actions.c,v $ + * Revision 1.7 2001/06/09 10:55:28 jongfoster + * Changing BUFSIZ ==> BUFFER_SIZE + * + * Revision 1.6 2001/06/07 23:04:34 jongfoster + * Made get_actions() static. + * + * Revision 1.5 2001/06/03 19:11:48 oes + * adapted to new enlist_unique arg format + * + * Revision 1.4 2001/06/01 20:03:42 jongfoster + * Better memory management - current_action->strings[] now + * contains copies of the strings, not the original. + * + * Revision 1.3 2001/06/01 18:49:17 jongfoster + * Replaced "list_share" with "list" - the tiny memory gain was not + * worth the extra complexity. + * * Revision 1.2 2001/05/31 21:40:00 jongfoster * Removing some commented out, obsolete blocks of code. * @@ -58,6 +75,8 @@ const char actions_rcs[] = "$Id: actions.c,v 1.2 2001/05/31 21:40:00 jongfoster const char actions_h_rcs[] = ACTIONS_H_VERSION; + +/* Turn off everything except forwarding */ /* This structure is used to hold user-defined aliases */ struct action_alias { @@ -69,9 +88,9 @@ struct action_alias /* * Must declare this in this file for the above structure. - * FIXME: Make this static or put structure in header. */ -extern int get_actions (char *line, struct action_alias * alias_list, +static int get_actions (char *line, + struct action_alias * alias_list, struct action_spec *cur_action); /* @@ -390,8 +409,9 @@ int get_action_token(char **line, char **name, char **value) * nonzero => Error (line was trashed anyway) * *********************************************************************/ -int get_actions(char *line, struct action_alias * alias_list, - struct action_spec *cur_action) +static int get_actions(char *line, + struct action_alias * alias_list, + struct action_spec *cur_action) { memset(cur_action, '\0', sizeof(*cur_action)); cur_action->mask = ACTION_MASK_ALL; @@ -462,7 +482,7 @@ int get_actions(char *line, struct action_alias * alias_list, } list_remove_item(remove, value); - enlist_unique(add, value); + enlist_unique(add, value, 0); break; } case AV_REM_MULTI: @@ -491,7 +511,7 @@ int get_actions(char *line, struct action_alias * alias_list, if ( !cur_action->multi_remove_all[action->index] ) { /* there isn't a catch-all in the remove list already */ - enlist_unique(remove, value); + enlist_unique(remove, value, 0); } list_remove_item(add, value); } @@ -737,7 +757,8 @@ void merge_current_action (struct current_action_spec *dest, char * str = src->string[i]; if (str) { - dest->string[i] = str; + freez(dest->string[i]); + dest->string[i] = strdup(str); } } @@ -774,6 +795,11 @@ void free_current_action (struct current_action_spec *src) { int i; + for (i = 0; i < ACTION_STRING_COUNT; i++) + { + freez(src->string[i]); + } + for (i = 0; i < ACTION_MULTI_COUNT; i++) { destroy_list(src->multi[i]); @@ -832,7 +858,7 @@ int load_actions_file(struct client_state *csp) struct url_actions *last_perm; struct url_actions *perm; - char buf[BUFSIZ]; + char buf[BUFFER_SIZE]; struct file_list *fs; #define MODE_START_OF_FILE 1 #define MODE_ACTIONS 2 @@ -929,7 +955,7 @@ int load_actions_file(struct client_state *csp) { /* It's an actions block */ - char actions_buf[BUFSIZ]; + char actions_buf[BUFFER_SIZE]; char * end; /* set mode */ @@ -981,7 +1007,7 @@ int load_actions_file(struct client_state *csp) else if (mode == MODE_ALIAS) { /* define an alias */ - char actions_buf[BUFSIZ]; + char actions_buf[BUFFER_SIZE]; struct action_alias * new_alias; int more = 1;