X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=actions.c;h=258862fd3e33e926174d753db67d23b60bc5b9cc;hp=9388449859fb5b26c75d79944a5d940f41cf9ed6;hb=48838cd08e13bf038e82e7a2ca7350a5826217d6;hpb=d07371e61491a6efa4e119dbb4a805e72348604a diff --git a/actions.c b/actions.c index 93884498..258862fd 100644 --- a/actions.c +++ b/actions.c @@ -1,4 +1,4 @@ -const char actions_rcs[] = "$Id: actions.c,v 1.1 2001/05/31 21:16:46 jongfoster Exp $"; +const char actions_rcs[] = "$Id: actions.c,v 1.5 2001/06/03 19:11:48 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/actions.c,v $ @@ -33,6 +33,74 @@ const char actions_rcs[] = "$Id: actions.c,v 1.1 2001/05/31 21:16:46 jongfoster * * Revisions : * $Log: actions.c,v $ + * Revision 1.5 2001/06/03 19:11:48 oes + * adapted to new enlist_unique arg format + * + * Revision 1.5 2001/06/03 11:03:48 oes + * Makefile/in + * + * introduced cgi.c + * + * actions.c: + * + * adapted to new enlist_unique arg format + * + * conf loadcfg.c + * + * introduced confdir option + * + * filters.c filtrers.h + * + * extracted-CGI relevant stuff + * + * jbsockets.c + * + * filled comment + * + * jcc.c + * + * support for new cgi mechansim + * + * list.c list.h + * + * functions for new list type: "map" + * extended enlist_unique + * + * miscutil.c .h + * introduced bindup() + * + * parsers.c parsers.h + * + * deleted const struct interceptors + * + * pcrs.c + * added FIXME + * + * project.h + * + * added struct map + * added struct http_response + * changes struct interceptors to struct cgi_dispatcher + * moved HTML stuff to cgi.h + * + * re_filterfile: + * + * changed + * + * showargs.c + * NO TIME LEFT + * + * 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. + * * Revision 1.1 2001/05/31 21:16:46 jongfoster * Moved functions to process the action list into this new file. * @@ -55,6 +123,8 @@ const char actions_rcs[] = "$Id: actions.c,v 1.1 2001/05/31 21:16:46 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 { @@ -66,9 +136,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); /* @@ -387,8 +457,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; @@ -459,7 +530,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: @@ -488,7 +559,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); } @@ -627,7 +698,7 @@ char * current_action_to_text(struct current_action_spec *action) { unsigned flags = action->flags; char * result = strdup(""); - struct list_share * lst; + struct list * lst; #define DEFINE_ACTION_BOOL(__name, __bit) \ if (flags & __bit) \ @@ -734,7 +805,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); } } @@ -743,13 +815,13 @@ void merge_current_action (struct current_action_spec *dest, if (src->multi_remove_all[i]) { /* Remove everything from dest */ - destroy_list_share(dest->multi[i]); - list_duplicate_share(dest->multi[i], src->multi_add[i]); + destroy_list(dest->multi[i]); + list_duplicate(dest->multi[i], src->multi_add[i]); } else { - list_remove_list_share(dest->multi[i], src->multi_remove[i]); - list_append_list_unique_share(dest->multi[i], src->multi_add[i]); + list_remove_list(dest->multi[i], src->multi_remove[i]); + list_append_list_unique(dest->multi[i], src->multi_add[i]); } } } @@ -771,9 +843,14 @@ 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_share(src->multi[i]); + destroy_list(src->multi[i]); } memset(src, '\0', sizeof(*src));