[prev in list] [next in list] [prev in thread] [next in thread]
List: privoxy-commits
Subject: [privoxy-commits] current ChangeLog, 1.76, 1.77 actions.c, 1.44,
From: noreply () sourceforge ! net
Date: 2008-03-24 11:21:15
Message-ID: E1Jdkjr-0001ri-9n () mail ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/ijbswa/current
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv3167
Modified Files:
ChangeLog actions.c project.h
Log Message:
Share the action settings for multiple patterns in the same
section so we waste less memory for gigantic block lists
(and load them slightly faster). Reported by Franz Schwartau.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/ijbswa/current/ChangeLog,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- ChangeLog 21 Mar 2008 11:14:00 -0000 1.76
+++ ChangeLog 24 Mar 2008 11:21:02 -0000 1.77
@@ -20,6 +20,9 @@
file modification timestamps. This makes life harder for attackers
who can leverage browser bugs to send fake Referers and intend to
brute-force edit URLs.
+- Action settings for multiple patterns in the same section are
+ shared in memory. As a result these sections take up less space
+ (and are loaded slightly faster). Problem reported by Franz Schwartau.
- Host information is gathered outside the main thread so it's less
likely to delay other incoming connections if the host is misconfigured.
- The CGI editor supports the "disable all filters of this type"
Index: actions.c
===================================================================
RCS file: /cvsroot/ijbswa/current/actions.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- actions.c 4 Mar 2008 18:30:34 -0000 1.44
+++ actions.c 24 Mar 2008 11:21:02 -0000 1.45
@@ -33,6 +33,11 @@
*
* Revisions :
* $Log$
+ * Revision 1.45 2008/03/24 11:21:02 fabiankeil
+ * Share the action settings for multiple patterns in the same
+ * section so we waste less memory for gigantic block lists
+ * (and load them slightly faster). Reported by Franz Schwartau.
+ *
* Revision 1.44 2008/03/04 18:30:34 fabiankeil
* Remove the treat-forbidden-connects-like-blocks action. We now
* use the "blocked" page for forbidden CONNECT requests by default.
@@ -466,6 +471,24 @@
return err;
}
+/*********************************************************************
+ *
+ * Function : free_action_spec
+ *
+ * Description : Frees an action_spec and the memory used by it.
+ *
+ * Parameters :
+ * 1 : src = Source to free.
+ *
+ * Returns : N/A
+ *
+ *********************************************************************/
+void free_action_spec(struct action_spec *src)
+{
+ free_action(src);
+ freez(src);
+}
+
/*********************************************************************
*
@@ -1123,11 +1146,19 @@
{
next = cur->next;
free_url_spec(cur->url);
- free_action(cur->action);
+ if ((next == NULL) || (next->action != cur->action))
+ {
+ /*
+ * As the action settings might be shared,
+ * we can only free them if the current
+ * url pattern is the last one, or if the
+ * next one is using different settings.
+ */
+ free_action_spec(cur->action);
+ }
freez(cur);
cur = next;
}
-
}
@@ -1392,8 +1423,7 @@
{
if (!cur_action_used)
{
- free_action(cur_action);
- free(cur_action);
+ free_action_spec(cur_action);
}
cur_action = NULL;
}
@@ -1582,8 +1612,8 @@
return 1; /* never get here */
}
- /* Save flags */
- copy_action (perm->action, cur_action);
+ perm->action = cur_action;
+ cur_action_used = 1;
/* Save the URL pattern */
if (create_url_spec(perm->url, buf))
@@ -1621,9 +1651,10 @@
fclose(fp);
- free_action(cur_action);
- freez(cur_action);
-
+ if (!cur_action_used)
+ {
+ free_action_spec(cur_action);
+ }
free_alias_list(alias_list);
/* the old one is now obsolete */
Index: project.h
===================================================================
RCS file: /cvsroot/ijbswa/current/project.h,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- project.h 21 Mar 2008 11:16:27 -0000 1.105
+++ project.h 24 Mar 2008 11:21:03 -0000 1.106
@@ -37,6 +37,11 @@
*
* Revisions :
* $Log$
+ * Revision 1.106 2008/03/24 11:21:03 fabiankeil
+ * Share the action settings for multiple patterns in the same
+ * section so we waste less memory for gigantic block lists
+ * (and load them slightly faster). Reported by Franz Schwartau.
+ *
* Revision 1.105 2008/03/21 11:16:27 fabiankeil
* Garbage-collect csp->my_ip_addr_str and csp->my_hostname.
*
@@ -1182,18 +1187,22 @@
/**
- * This structure is used to store the actions list.
+ * This structure is used to store action files.
*
- * It contains a URL pattern, and the chages to the actions.
- * It is a linked list.
+ * It contains an URL or tag pattern, and the changes to
+ * the actions. It's a linked list and should only be
+ * free'd through unload_actions_file() unless there's
+ * only a single entry.
*/
struct url_actions
{
- struct url_spec url[1]; /**< URL pattern. */
+ struct url_spec url[1]; /**< The URL or tag pattern. */
- struct action_spec action[1]; /**< Actions. */
+ struct action_spec *action; /**< Action settings that might be shared with
+ the list entry before or after the current
+ one and can't be free'd willy nilly. */
- struct url_actions * next; /**< Next action in file, or NULL. */
+ struct url_actions *next; /**< Next action section in file, or NULL. */
};
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic