Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/7e7ea09000c9386dfa4db...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/7e7ea09000c9386dfa4db75...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/7e7ea09000c9386dfa4db75be...
The branch, master has been updated
via 7e7ea09000c9386dfa4db75be3ea6c49ab203cfd (commit)
from c2bd86ca9644734ad87b560757251e26fde666b7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=7e7ea09000c9386dfa4...
commit 7e7ea09000c9386dfa4db75be3ea6c49ab203cfd
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Allocate generic list objects using itempools
TODO: Allocate the attached structures also using itempools
diff --git a/amiga/gui.c b/amiga/gui.c
index 58e7938..2521acb 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3049,6 +3049,8 @@ static void gui_quit(void)
FreeVec(current_user_faviconcache);
FreeVec(current_user);
+ ami_object_fini();
+
ami_libs_close();
}
@@ -5497,6 +5499,8 @@ int main(int argc, char** argv)
/* Open splash window */
Object *splash_window = ami_gui_splash_open();
+ ami_object_init();
+
if (ami_open_resources() == false) { /* alloc message ports */
ami_misc_fatal_error("Unable to allocate resources");
ami_gui_splash_close(splash_window);
diff --git a/amiga/misc.c b/amiga/misc.c
index 9100120..97e9f9f 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -52,10 +52,10 @@ APTR ami_misc_itempool_create(int size)
ASOITEM_MFlags, MEMF_PRIVATE,
ASOITEM_ItemSize, size,
ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
- ASOITEM_GCParameter, 50,
+ ASOITEM_GCParameter, 100,
TAG_DONE);
#else
- return CreatePool(MEMF_ANY, 2 * size, size);
+ return CreatePool(MEMF_ANY, 20 * size, size);
#endif
}
diff --git a/amiga/object.c b/amiga/object.c
index 7d93594..aab66bb 100755
--- a/amiga/object.c
+++ b/amiga/object.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005,2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2005, 2008, 2016 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -18,7 +18,9 @@
#include "amiga/os3support.h"
+#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <proto/exec.h>
#include <exec/lists.h>
@@ -35,6 +37,21 @@
#define NewnsList NewList
#endif
+APTR pool_nsobj = NULL;
+
+bool ami_object_init(void)
+{
+ pool_nsobj = ami_misc_itempool_create(sizeof(struct nsObject));
+
+ if(pool_nsobj == NULL) return false;
+ else return true;
+}
+
+void ami_object_fini(void)
+{
+ ami_misc_itempool_delete(pool_nsobj);
+}
+
/* Slightly abstract MinList initialisation */
void ami_NewMinList(struct MinList *list)
{
@@ -61,8 +78,10 @@ struct nsObject *AddObject(struct MinList *objlist, ULONG otype)
{
struct nsObject *dtzo;
- dtzo = (struct nsObject *)ami_misc_allocvec_clear(sizeof(struct nsObject), 0);
+ dtzo = (struct nsObject *)ami_misc_itempool_alloc(pool_nsobj, sizeof(struct nsObject));
+ if(dtzo == NULL) return NULL;
+ memset(dtzo, 0, sizeof(struct nsObject));
AddTail((struct List *)objlist,(struct Node *)dtzo);
dtzo->Type = otype;
@@ -81,7 +100,7 @@ static void DelObjectInternal(struct nsObject *dtzo, BOOL free_obj)
if(dtzo->callback != NULL) dtzo->callback(dtzo->objstruct);
if(dtzo->objstruct && free_obj) FreeVec(dtzo->objstruct);
if(dtzo->dtz_Node.ln_Name) free(dtzo->dtz_Node.ln_Name);
- FreeVec(dtzo);
+ ami_misc_itempool_free(pool_nsobj, dtzo, sizeof(struct nsObject));
dtzo = NULL;
}
@@ -110,3 +129,4 @@ void FreeObjList(struct MinList *objlist)
FreeVec(objlist);
}
+
diff --git a/amiga/object.h b/amiga/object.h
index 85cbb6d..6ea9bd1 100755
--- a/amiga/object.h
+++ b/amiga/object.h
@@ -58,5 +58,9 @@ void FreeObjList(struct MinList *objlist);
/** List abstraction as OS3 appears to have problems with NewMinList() **/
struct MinList *ami_AllocMinList(void);
void ami_NewMinList(struct MinList *list);
+
+/** Initialisation for itempool **/
+bool ami_object_init(void);
+void ami_object_fini(void);
#endif
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 4 ++++
amiga/misc.c | 4 ++--
amiga/object.c | 26 +++++++++++++++++++++++---
amiga/object.h | 4 ++++
4 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 58e7938..2521acb 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3049,6 +3049,8 @@ static void gui_quit(void)
FreeVec(current_user_faviconcache);
FreeVec(current_user);
+ ami_object_fini();
+
ami_libs_close();
}
@@ -5497,6 +5499,8 @@ int main(int argc, char** argv)
/* Open splash window */
Object *splash_window = ami_gui_splash_open();
+ ami_object_init();
+
if (ami_open_resources() == false) { /* alloc message ports */
ami_misc_fatal_error("Unable to allocate resources");
ami_gui_splash_close(splash_window);
diff --git a/amiga/misc.c b/amiga/misc.c
index 9100120..97e9f9f 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -52,10 +52,10 @@ APTR ami_misc_itempool_create(int size)
ASOITEM_MFlags, MEMF_PRIVATE,
ASOITEM_ItemSize, size,
ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
- ASOITEM_GCParameter, 50,
+ ASOITEM_GCParameter, 100,
TAG_DONE);
#else
- return CreatePool(MEMF_ANY, 2 * size, size);
+ return CreatePool(MEMF_ANY, 20 * size, size);
#endif
}
diff --git a/amiga/object.c b/amiga/object.c
index 7d93594..aab66bb 100755
--- a/amiga/object.c
+++ b/amiga/object.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005,2008 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2005, 2008, 2016 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf,
http://www.netsurf-browser.org/
*
@@ -18,7 +18,9 @@
#include "amiga/os3support.h"
+#include <stdbool.h>
#include <stdlib.h>
+#include <string.h>
#include <proto/exec.h>
#include <exec/lists.h>
@@ -35,6 +37,21 @@
#define NewnsList NewList
#endif
+APTR pool_nsobj = NULL;
+
+bool ami_object_init(void)
+{
+ pool_nsobj = ami_misc_itempool_create(sizeof(struct nsObject));
+
+ if(pool_nsobj == NULL) return false;
+ else return true;
+}
+
+void ami_object_fini(void)
+{
+ ami_misc_itempool_delete(pool_nsobj);
+}
+
/* Slightly abstract MinList initialisation */
void ami_NewMinList(struct MinList *list)
{
@@ -61,8 +78,10 @@ struct nsObject *AddObject(struct MinList *objlist, ULONG otype)
{
struct nsObject *dtzo;
- dtzo = (struct nsObject *)ami_misc_allocvec_clear(sizeof(struct nsObject), 0);
+ dtzo = (struct nsObject *)ami_misc_itempool_alloc(pool_nsobj, sizeof(struct nsObject));
+ if(dtzo == NULL) return NULL;
+ memset(dtzo, 0, sizeof(struct nsObject));
AddTail((struct List *)objlist,(struct Node *)dtzo);
dtzo->Type = otype;
@@ -81,7 +100,7 @@ static void DelObjectInternal(struct nsObject *dtzo, BOOL free_obj)
if(dtzo->callback != NULL) dtzo->callback(dtzo->objstruct);
if(dtzo->objstruct && free_obj) FreeVec(dtzo->objstruct);
if(dtzo->dtz_Node.ln_Name) free(dtzo->dtz_Node.ln_Name);
- FreeVec(dtzo);
+ ami_misc_itempool_free(pool_nsobj, dtzo, sizeof(struct nsObject));
dtzo = NULL;
}
@@ -110,3 +129,4 @@ void FreeObjList(struct MinList *objlist)
FreeVec(objlist);
}
+
diff --git a/amiga/object.h b/amiga/object.h
index 85cbb6d..6ea9bd1 100755
--- a/amiga/object.h
+++ b/amiga/object.h
@@ -58,5 +58,9 @@ void FreeObjList(struct MinList *objlist);
/** List abstraction as OS3 appears to have problems with NewMinList() **/
struct MinList *ami_AllocMinList(void);
void ami_NewMinList(struct MinList *list);
+
+/** Initialisation for itempool **/
+bool ami_object_init(void);
+void ami_object_fini(void);
#endif
--
NetSurf Browser