netsurf: branch master updated. release/3.6-19-g3ab8032
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/3ab8032f1679c2a3526cc...
...commit http://git.netsurf-browser.org/netsurf.git/commit/3ab8032f1679c2a3526ccd4...
...tree http://git.netsurf-browser.org/netsurf.git/tree/3ab8032f1679c2a3526ccd458...
The branch, master has been updated
via 3ab8032f1679c2a3526ccd458eb130c0d0f917bc (commit)
via eab6c0c99e29e10a3ac409b8de7c0e39ef918358 (commit)
via 15a68714919c64edc04d6e26679fabb490bdf9a2 (commit)
via 0513782fe3bb2884d0f63fb11c69f06055332388 (commit)
via 05fa29ba8bc2dbfaa9af7ed1263554c7cdc9214d (commit)
via 4f0c9b6c610d1eb9a5bcccf6dbf3f53410df9432 (commit)
via 2c6f2f4ef5a50c36676308f6663c0d21edc6aa70 (commit)
via a8bd2af7103bca7145f8c566ec46f27e2be8d182 (commit)
via 81a7e0cbe9851c2388e53950a6db3e75b1156ead (commit)
from faf4c1fb6012941134046db14370f60748184b05 (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=3ab8032f1679c2a3526...
commit 3ab8032f1679c2a3526ccd458eb130c0d0f917bc
Merge: faf4c1f eab6c0c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Merge branch 'chris/malloc'
This replaces most instances of AllocVec/FreeVec in the Amiga frontend code with malloc/free, to enable OS3 to get full benefit from the clib2 slab allocator.
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/arexx.c | 3 +-
frontends/amiga/bitmap.c | 6 +-
frontends/amiga/clipboard.c | 11 +-
frontends/amiga/download.c | 13 +-
frontends/amiga/dt_anim.c | 5 +-
frontends/amiga/file.c | 13 +-
frontends/amiga/filetype.c | 5 +-
frontends/amiga/font_bullet.c | 6 +-
frontends/amiga/font_cache.c | 2 +-
frontends/amiga/font_scan.c | 10 +-
frontends/amiga/gui.c | 38 ++---
frontends/amiga/gui.h | 7 +-
frontends/amiga/gui_options.c | 7 +-
frontends/amiga/history_local.c | 7 +-
frontends/amiga/icon.c | 11 +-
frontends/amiga/iff_dr2d.c | 27 ++--
frontends/amiga/launch.c | 10 +-
frontends/amiga/login.c | 3 +-
frontends/amiga/memory.c | 15 +-
frontends/amiga/memory.h | 14 +-
frontends/amiga/menu.c | 21 ++-
frontends/amiga/object.c | 6 +-
frontends/amiga/os3support.c | 317 +++++++++++++++++++--------------------
frontends/amiga/os3support.h | 1 -
frontends/amiga/plotters.c | 31 ++--
frontends/amiga/print.c | 17 +--
frontends/amiga/search.c | 3 +-
frontends/amiga/theme.c | 18 +--
frontends/amiga/tree.c | 17 +--
frontends/amiga/version.c | 12 +-
30 files changed, 331 insertions(+), 325 deletions(-)
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index ad2d237..cdb12c2 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -42,7 +42,6 @@
#include "amiga/hotlist.h"
#include "amiga/tree.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
@@ -272,7 +271,7 @@ RXHOOKF(rx_open)
{
if(!gw) return;
- dln = ami_misc_allocvec_clear(sizeof(struct dlnode), 0);
+ dln = calloc(1, sizeof(struct dlnode));
dln->filename = strdup((char *)cmd->ac_ArgList[3]);
dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
dln->node.ln_Type = NT_USER;
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 124c116..27ffee4 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -113,7 +113,7 @@ void *amiga_bitmap_create(int width, int height, unsigned int state)
bitmap = ami_misc_itempool_alloc(pool_bitmap, sizeof(struct bitmap));
if(bitmap == NULL) return NULL;
- bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
+ bitmap->pixdata = ami_memory_clear_alloc(width*height*4, 0xff);
bitmap->width = width;
bitmap->height = height;
@@ -170,7 +170,7 @@ void amiga_bitmap_destroy(void *bitmap)
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
if(bm->drawhandle) ReleaseDrawHandle(bm->drawhandle);
- FreeVec(bm->pixdata);
+ ami_memory_clear_free(bm->pixdata);
if(bm->url) nsurl_unref(bm->url);
if(bm->title) free(bm->title);
@@ -737,7 +737,7 @@ void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
void ami_bitmap_free_icondata(struct bitmap *bm)
{
- if(bm->icondata) FreeVec(bm->icondata);
+ if(bm->icondata) free(bm->icondata);
bm->icondata = NULL;
}
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 4933f59..9489110 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -45,7 +45,6 @@
#include "amiga/iff_cset.h"
#include "amiga/iff_dr2d.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/utf8.h"
#define ID_UTF8 MAKE_ID('U','T','F','8')
@@ -114,10 +113,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
case 0:
if(ci_new) {
- ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_next->ci_Next;
} else {
- ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_new = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_new;
}
@@ -128,10 +127,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
default:
if(ci_new) {
- ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_next->ci_Next;
} else {
- ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_new = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_new;
}
@@ -166,7 +165,7 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
if(ci_new) {
free(ci_curr->ci_Data);
- FreeVec(ci_curr);
+ free(ci_curr);
}
} while ((ci_curr = ci_next));
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 0750e5e..3eba893 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -64,7 +64,6 @@
#include "amiga/file.h"
#include "amiga/iff_dr2d.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
@@ -101,7 +100,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
APTR va[3];
- dw = ami_misc_allocvec_clear(sizeof(struct gui_download_window), 0);
+ dw = calloc(1, sizeof(struct gui_download_window));
if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
{
@@ -123,13 +122,13 @@ static struct gui_download_window *gui_download_window_create(download_context *
AddPart((STRPTR)&dw->fname,savereq->fr_File,1024);
if(!ami_download_check_overwrite(dw->fname, gui->shared->win, total_size))
{
- FreeVec(dw);
+ free(dw);
return NULL;
}
}
else
{
- FreeVec(dw);
+ free(dw);
return NULL;
}
}
@@ -146,7 +145,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
if(!(dw->fh = FOpen((STRPTR)&dw->fname,MODE_NEWFILE,0)))
{
- FreeVec(dw);
+ free(dw);
return NULL;
}
@@ -261,7 +260,7 @@ static void gui_download_window_done(struct gui_download_window *dw)
free(dln->filename);
Remove((struct Node *)dln);
- FreeVec(dln);
+ free(dln);
}
FClose(dw->fh);
@@ -344,7 +343,7 @@ void ami_free_download_list(struct List *dllist)
free(node->node.ln_Name);
free(node->filename);
Remove((struct Node *)node);
- FreeVec((struct Node *)node);
+ free((struct Node *)node);
}while((node=nnode));
}
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 3175cf1..a486334 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -46,7 +46,6 @@
#include "amiga/bitmap.h"
#include "amiga/filetype.h"
#include "amiga/datatypes.h"
-#include "amiga/memory.h"
#include "amiga/plotters.h"
typedef struct amiga_dt_anim_content {
@@ -216,7 +215,7 @@ bool amiga_dt_anim_convert(struct content *c)
#else
#warning FIXME: Need to use a different blitter function for OS3!
#endif
- FreeVec(clut);
+ free(clut);
adt_frame.MethodID = ADTM_UNLOADFRAME;
IDoMethodA(plugin->dto, (Msg)&adt_frame);
@@ -344,7 +343,7 @@ content_type amiga_dt_anim_content_type(void)
static APTR ami_colormap_to_clut(struct ColorMap *cmap)
{
int i;
- UBYTE *clut = ami_misc_allocvec_clear(256 * 4, 0); /* NB: Was not MEMF_PRIVATE */
+ UBYTE *clut = calloc(1, 256 * 4);
ULONG colr[256 * 4];
if(!clut) return NULL;
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index db0e716..04f8e8a 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -40,7 +40,6 @@
#include "amiga/filetype.h"
#include "amiga/icon.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/save_pdf.h"
#include "amiga/theme.h"
@@ -90,7 +89,7 @@ void ami_file_open(struct gui_window_2 *gwin)
ASLFR_FilterFunc, &aslhookfunc,
TAG_DONE))
{
- if((temp = AllocVecTagList(1024, NULL)))
+ if((temp = malloc(1024)))
{
strlcpy(temp, filereq->fr_Drawer, 1024);
AddPart(temp, filereq->fr_File, 1024);
@@ -108,7 +107,7 @@ void ami_file_open(struct gui_window_2 *gwin)
nsurl_unref(url);
}
- FreeVec(temp);
+ free(temp);
}
}
}
@@ -213,7 +212,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
void ami_file_save_req(int type, struct gui_window_2 *gwin,
struct hlcache_handle *object)
{
- char *fname = AllocVecTagList(1024, NULL);
+ char *fname = malloc(1024);
char *initial_fname = NULL;
char *fname_with_ext = NULL;
bool strip_ext = true;
@@ -224,7 +223,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
}
if(initial_fname != NULL) {
- fname_with_ext = AllocVecTagList(strlen(initial_fname) + 5, NULL); /* 5 = .ext\0 */
+ fname_with_ext = malloc(strlen(initial_fname) + 5); /* 5 = .ext\0 */
strcpy(fname_with_ext, initial_fname);
@@ -261,8 +260,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
ami_file_save(type, fname, gwin->win, object, gwin->gw->favicon, gwin->gw->bw);
}
- if(fname) FreeVec(fname);
- if(fname_with_ext) FreeVec(fname_with_ext);
+ if(fname) free(fname);
+ if(fname_with_ext) free(fname_with_ext);
}
void ami_file_req_init(void)
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index 8c658ee..a0449d8 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -31,7 +31,6 @@
#include "utils/utils.h"
#include "amiga/filetype.h"
-#include "amiga/memory.h"
#include "amiga/object.h"
/**
@@ -217,7 +216,7 @@ nserror ami_mime_init(const char *mimefile)
{
if ((node = AddObject(ami_mime_list, AMINS_MIME))) {
ObjectCallback(node, ami_mime_entry_free);
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
+ mimeentry = calloc(1, sizeof(struct ami_mime_entry));
node->objstruct = mimeentry;
if(rarray[AMI_MIME_MIMETYPE])
@@ -361,7 +360,7 @@ static APTR ami_mime_guess_add_datatype(struct DataType *dt, lwc_string **lwc_mi
node = AddObject(ami_mime_list, AMINS_MIME);
if(node == NULL) return NULL;
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
+ mimeentry = calloc(1, sizeof(struct ami_mime_entry));
if(mimeentry == NULL) return NULL;
node->objstruct = mimeentry;
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index bb0adb5..fd41c29 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -363,7 +363,7 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical
{
LOG("Requested font not found: %s", font);
if(critical == true) amiga_warn_user("CompError", font);
- FreeVec(nodedata);
+ free(nodedata);
return NULL;
}
@@ -601,7 +601,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
TAG_DONE);
#else
/* On OS3 the glyph needs to be in chip RAM */
- void *chip_glyph = AllocVec(glyph->glm_BMModulo * glyph->glm_BMRows, MEMF_CHIP);
+ void *chip_glyph = ami_memory_chip_alloc(glyph->glm_BMModulo * glyph->glm_BMRows);
if(chip_glyph != NULL) {
CopyMem(glyphbm, chip_glyph, glyph->glm_BMModulo * glyph->glm_BMRows);
@@ -612,7 +612,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
y - glyph->glm_Y0 + glyph->glm_BlackTop,
glyph->glm_BlackWidth, glyph->glm_BlackHeight);
- FreeVec(chip_glyph);
+ ami_memory_chip_free(chip_glyph);
}
#endif
}
diff --git a/frontends/amiga/font_cache.c b/frontends/amiga/font_cache.c
index 08c2fe1..3d83309 100644
--- a/frontends/amiga/font_cache.c
+++ b/frontends/amiga/font_cache.c
@@ -158,7 +158,7 @@ struct ami_font_cache_node *ami_font_cache_alloc_entry(const char *font)
uint32 hash = XXH32(font, strlen(font), 0);
nodedata = (struct ami_font_cache_node *)InsertSkipNode(ami_font_cache_list, (APTR)hash, sizeof(struct ami_font_cache_node));
#else
- nodedata = AllocVecTagList(sizeof(struct ami_font_cache_node), NULL);
+ nodedata = malloc(sizeof(struct ami_font_cache_node));
#endif
GetSysTime(&nodedata->lastused);
diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c
index c1c1732..932179e 100644
--- a/frontends/amiga/font_scan.c
+++ b/frontends/amiga/font_scan.c
@@ -99,7 +99,7 @@ const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray)
static struct ami_font_scan_window *ami_font_scan_gui_open(int32 fonts)
{
struct ami_font_scan_window *fsw =
- AllocVecTagList(sizeof(struct ami_font_scan_window), NULL);
+ malloc(sizeof(struct ami_font_scan_window));
if(fsw == NULL) return NULL;
@@ -201,7 +201,7 @@ static void ami_font_scan_gui_close(struct ami_font_scan_window *fsw)
if(fsw) {
DisposeObject(fsw->objects[FS_OID_MAIN]);
ami_utf8_free(fsw->title);
- FreeVec(fsw);
+ free(fsw);
}
}
@@ -317,10 +317,10 @@ static ULONG ami_font_scan_list(struct MinList *list)
struct nsObject *node;
do {
- if((afh = (struct AvailFontsHeader *)AllocVecTagList(afSize, NULL))) {
+ if((afh = (struct AvailFontsHeader *)malloc(afSize))) {
if(((afShortage = AvailFonts((STRPTR)afh, afSize,
AFF_DISK | AFF_OTAG | AFF_SCALED)))) {
- FreeVec(afh);
+ free(afh);
afSize += afShortage;
}
} else {
@@ -350,7 +350,7 @@ static ULONG ami_font_scan_list(struct MinList *list)
}
}
}
- FreeVec(afh);
+ free(afh);
} else {
return 0;
}
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index df03756..ecc36fa 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -140,8 +140,8 @@
#include "amiga/launch.h"
#include "amiga/libs.h"
#include "amiga/login.h"
-#include "amiga/menu.h"
#include "amiga/memory.h"
+#include "amiga/menu.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/plotters.h"
@@ -1371,7 +1371,7 @@ nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox)
{
#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- *bbox = AllocVecTagList(sizeof(struct IBox), NULL);
+ *bbox = malloc(sizeof(struct IBox));
if(*bbox == NULL) return NSERROR_NOMEM;
GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox);
} else
@@ -1388,7 +1388,7 @@ void ami_gui_free_space_box(struct IBox *bbox)
{
#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- FreeVec(bbox);
+ free(bbox);
}
#endif
}
@@ -1516,7 +1516,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
{
struct IBox *bbox, *ibox;
- ibox = AllocVecTagList(sizeof(struct IBox), NULL);
+ ibox = malloc(sizeof(struct IBox));
if(ibox == NULL) return NULL;
if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
@@ -1537,7 +1537,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
(ibox->Top > (bbox->Top + bbox->Height)) ||
(ibox->Width < 0) || (ibox->Height < 0))
{
- FreeVec(ibox);
+ free(ibox);
ami_gui_free_space_box(bbox);
return NULL;
}
@@ -2585,7 +2585,7 @@ static void ami_handle_appmsg(void)
{
if((appwinargs = &appmsg->am_ArgList[i]))
{
- if((filename = AllocVecTagList(1024, NULL)))
+ if((filename = malloc(1024)))
{
if(appwinargs->wa_Lock)
{
@@ -2666,7 +2666,7 @@ static void ami_handle_appmsg(void)
}
}
}
- FreeVec(filename);
+ free(filename);
}
}
}
@@ -3819,7 +3819,7 @@ gui_window_create(struct browser_window *bw,
if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
- g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0);
+ g = calloc(1, sizeof(struct gui_window));
if(!g)
{
@@ -3893,7 +3893,7 @@ gui_window_create(struct browser_window *bw,
return g;
}
- g->shared = ami_misc_allocvec_clear(sizeof(struct gui_window_2), 0);
+ g->shared = calloc(1, sizeof(struct gui_window_2));
if(!g->shared)
{
@@ -3956,7 +3956,7 @@ gui_window_create(struct browser_window *bw,
g->shared->tabs=1;
g->shared->next_tab=1;
- g->shared->svbuffer = ami_misc_allocvec_clear(2000, 0);
+ g->shared->svbuffer = calloc(1, 2000);
g->shared->helphints[GID_BACK] =
translate_escape_chars(messages_get("HelpToolbarBack"));
@@ -4348,8 +4348,8 @@ gui_window_create(struct browser_window *bw,
if(!g->shared->win)
{
amiga_warn_user("NoMemory","");
- FreeVec(g->shared);
- FreeVec(g);
+ free(g->shared);
+ free(g);
return NULL;
}
@@ -4529,12 +4529,12 @@ static void gui_window_destroy(struct gui_window *g)
ami_utf8_free(g->tabtitle);
- FreeVec(g);
+ free(g);
return;
}
ami_plot_release_pens(g->shared->shared_pens);
- FreeVec(g->shared->shared_pens);
+ free(g->shared->shared_pens);
ami_schedule_redraw_remove(g->shared);
ami_schedule(-1, ami_gui_refresh_favicon, g->shared);
@@ -4564,7 +4564,7 @@ static void gui_window_destroy(struct gui_window *g)
free(g->shared->wintitle);
ami_utf8_free(g->shared->status);
- FreeVec(g->shared->svbuffer);
+ free(g->shared->svbuffer);
for(gid = 0; gid < GID_LAST; gid++)
free(g->shared->helphints[gid]);
@@ -4574,7 +4574,7 @@ static void gui_window_destroy(struct gui_window *g)
Remove(g->tab_node);
FreeClickTabNode(g->tab_node);
}
- FreeVec(g); // g->shared should be freed by DelObject()
+ free(g); // g->shared should be freed by DelObject()
if(IsMinListEmpty(window_list))
{
@@ -5266,7 +5266,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
if(g->shared->ptr_lock)
{
- FreeVec(g->shared->ptr_lock);
+ free(g->shared->ptr_lock);
g->shared->ptr_lock = NULL;
}
}
@@ -5612,7 +5612,7 @@ int main(int argc, char** argv)
len += strlen(users_dir);
len += 2; /* for poss path sep and NULL term */
- current_user_dir = AllocVecTagList(len, NULL);
+ current_user_dir = malloc(len);
if(current_user_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
ami_schedule_free();
@@ -5729,7 +5729,7 @@ int main(int argc, char** argv)
netsurf_exit();
ami_nsoption_free();
- FreeVec(current_user_dir);
+ free(current_user_dir);
FreeVec(current_user_faviconcache);
FreeVec(current_user);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 6d5188e..db3fef20 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -176,11 +176,15 @@ extern struct Screen *scrn;
extern struct MsgPort *sport;
extern struct gui_window *cur_gw;
+/* The return value for these functions must be deallocated using FreeVec() */
+STRPTR ami_locale_langs(int *codeset);
+char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
+
+/* Functions lacking documentation */
void ami_get_msg(void);
void ami_try_quit(void);
void ami_quit_netsurf(void);
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw);
-STRPTR ami_locale_langs(int *codeset);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y);
bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y,
@@ -192,7 +196,6 @@ void ami_gui_tabs_toggle_all(void);
bool ami_locate_resource(char *fullpath, const char *file);
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
-char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
int ami_gui_count_windows(int window, int *tabs);
void ami_gui_set_scale(struct gui_window *gw, float scale);
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index a890a91..fb5d1b1 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -73,7 +73,6 @@
#include "amiga/gui_options.h"
#include "amiga/help.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/nsoption.h"
#include "amiga/object.h"
#include "amiga/selectmenu.h"
@@ -636,7 +635,7 @@ void ami_gui_opts_open(void)
if(!gow)
{
- gow = ami_misc_allocvec_clear(sizeof(struct ami_gui_opts_window), 0);
+ gow = calloc(1, sizeof(struct ami_gui_opts_window));
if(gow == NULL) return;
ami_gui_opts_setup(gow);
@@ -2284,7 +2283,7 @@ struct List *ami_gui_opts_websearch(void)
const char *name;
int iter;
- list = AllocVecTagList(sizeof(struct List), NULL);
+ list = malloc(sizeof(struct List));
NewList(list);
if (nsoption_charp(search_engines_file) == NULL) return list;
@@ -2314,6 +2313,6 @@ void ami_gui_opts_websearch_free(struct List *websearchlist)
FreeChooserNode(node);
} while((node = nnode));
- FreeVec(websearchlist);
+ free(websearchlist);
}
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index fa5c249..5009ce8 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -51,7 +51,6 @@
#include "graphics/rpattr.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
#include "amiga/plotters.h"
@@ -117,8 +116,8 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
- gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0);
- gw->hw->gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
+ gw->hw = calloc(1, sizeof(struct history_window));
+ gw->hw->gg = calloc(1, sizeof(struct gui_globals));
ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false);
@@ -227,7 +226,7 @@ static bool ami_history_click(struct history_window *hw, uint16 code)
void ami_history_close(struct history_window *hw)
{
ami_free_layers(hw->gg);
- FreeVec(hw->gg);
+ free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
DelObject(hw->node);
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index fd996ef..3f597a1 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -49,7 +49,6 @@
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
#include "amiga/icon.h"
-#include "amiga/memory.h"
#define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */
#define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */
@@ -239,7 +238,7 @@ bool amiga_icon_convert(struct content *c)
if(dobj) FreeDiskObject(dobj);
if(format==IDFMT_PALETTEMAPPED)
- FreeVec(imagebufptr);
+ free(imagebufptr);
return true;
}
@@ -326,7 +325,7 @@ static ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG
if (alpha==0) alpha=0xff;
- argbicon = (ULONG *)AllocVecTagList(width*height*4, NULL);
+ argbicon = (ULONG *)malloc(width * height * 4);
if (!argbicon) return(NULL);
cmap=GetColorMap(pals1);
@@ -485,8 +484,8 @@ void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, cha
if(format == IDFMT_PALETTEMAPPED)
{
/* Free the 32-bit data we created */
- FreeVec(icondata1);
- FreeVec(icondata2);
+ free(icondata1);
+ free(icondata2);
}
}
@@ -501,7 +500,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
- icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);
if(bitmap) {
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index 1c8d7db..91973f4 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -19,6 +19,7 @@
#ifdef WITH_NS_SVG
#include <stdio.h>
+#include <stdlib.h>
#include <inttypes.h>
#include <svgtiny.h>
#include <proto/exec.h>
@@ -30,11 +31,9 @@
#include "netsurf/content.h"
#include "amiga/os3support.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/memory.h"
#else
#include "os3support.h"
#include "iff_dr2d.h"
-#include "misc.h"
#endif
static struct ColorRegister cm[1000];
@@ -171,7 +170,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
}
for (unsigned int i = 0; i != diagram->shape_count; i++) {
- attr = ami_misc_allocvec_clear(sizeof(struct attr_struct), 0);
+ attr = calloc(1, sizeof(struct attr_struct));
if (diagram->shape[i].fill == svgtiny_TRANSPARENT)
attr->FillType = FT_NONE;
else
@@ -193,7 +192,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
WriteChunkBytes(iffh,attr,14);
PopChunk(iffh);
}
- FreeVec(attr);
+ free(attr);
if (diagram->shape[i].path) {
union {
@@ -272,30 +271,30 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
PopChunk(iffh);
}
} else if (diagram->shape[i].text) {
- stxt = ami_misc_allocvec_clear(sizeof(struct stxt_struct), 0);
+ stxt = calloc(1, sizeof(struct stxt_struct));
stxt->BaseX = diagram->shape[i].text_x;
stxt->BaseY = diagram->shape[i].text_y;
stxt->NumChars = strlen(diagram->shape[i].text);
if(!fons_written)
{
- fons = ami_misc_allocvec_clear(sizeof(struct fons_struct), 0);
- if(!(PushChunk(iffh,0,ID_FONS,IFFSIZE_UNKNOWN)))
+ fons = calloc(1, sizeof(struct fons_struct));
+ if(!(PushChunk(iffh, 0, ID_FONS, IFFSIZE_UNKNOWN)))
{
WriteChunkBytes(iffh, fons, sizeof(struct fons_struct));
WriteChunkBytes(iffh, "Topaz\0", 6);
PopChunk(iffh);
}
- FreeVec(fons);
+ free(fons);
fons_written = TRUE;
}
- if(!(PushChunk(iffh,0,ID_STXT,IFFSIZE_UNKNOWN)))
+ if(!(PushChunk(iffh, 0, ID_STXT, IFFSIZE_UNKNOWN)))
{
- WriteChunkBytes(iffh,stxt,26);
- WriteChunkBytes(iffh,diagram->shape[i].text,strlen(diagram->shape[i].text));
+ WriteChunkBytes(iffh, stxt, 26);
+ WriteChunkBytes(iffh, diagram->shape[i].text, strlen(diagram->shape[i].text));
PopChunk(iffh);
}
- FreeVec(stxt);
+ free(stxt);
}
}
@@ -380,7 +379,7 @@ int main(int argc, char **argv)
{
size = GetFileSize(fh);
- buffer = AllocVecTagList((uint32_t)size, NULL);
+ buffer = malloc((uint32_t)size);
Read(fh,buffer,(uint32_t)size);
Close(fh);
@@ -404,7 +403,7 @@ int main(int argc, char **argv)
ami_svg_to_dr2d(iffh,buffer,size,(char *)rarray[A_SVG]);
- FreeVec(buffer);
+ free(buffer);
if(iffh) CloseIFF(iffh);
if(iffh->iff_Stream) Close((BPTR)iffh->iff_Stream);
if(iffh) FreeIFF(iffh);
diff --git a/frontends/amiga/launch.c b/frontends/amiga/launch.c
index 8020dd6..31800ef 100755
--- a/frontends/amiga/launch.c
+++ b/frontends/amiga/launch.c
@@ -50,10 +50,10 @@ static struct ami_protocol *ami_openurl_add_protocol(const char *url)
{
nsurl *ns_url;
struct ami_protocol *ami_p =
- (struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
+ (struct ami_protocol *)malloc(sizeof(struct ami_protocol));
if (nsurl_create(url, &ns_url) != NSERROR_OK) {
- FreeVec(ami_p);
+ free(ami_p);
return NULL;
}
@@ -61,7 +61,7 @@ static struct ami_protocol *ami_openurl_add_protocol(const char *url)
nsurl_unref(ns_url);
if (ami_p->protocol == NULL)
{
- FreeVec(ami_p);
+ free(ami_p);
return NULL;
}
@@ -83,11 +83,11 @@ static void ami_openurl_free_list(struct MinList *list)
Remove((struct Node *)node);
if (node->protocol) lwc_string_unref(node->protocol);
- FreeVec(node);
+ free(node);
node = NULL;
}while((node=nnode));
- FreeVec(list);
+ free(list);
}
static BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index e1d2891..805e25c 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,7 +46,6 @@
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/object.h"
#include "amiga/login.h"
@@ -67,7 +66,7 @@ void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
const char *auth;
- struct gui_login_window *lw = ami_misc_allocvec_clear(sizeof(struct gui_login_window), 0);
+ struct gui_login_window *lw = calloc(1, sizeof(struct gui_login_window));
lwc_string *host = nsurl_get_component(url, NSURL_HOST);
assert(host != NULL);
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 874f852..7a34f7a 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -25,17 +25,28 @@
ULONG __slab_max_size = 8192; /* Enable clib2's slab allocator */
#endif
-void *ami_misc_allocvec_clear(int size, UBYTE value)
+/* Special clear (ie. non-zero), which is different on OS3 and 4 */
+void *ami_memory_clear_alloc(size_t size, UBYTE value)
{
#ifdef __amigaos4__
return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
#else
- void *mem = AllocVec(size, MEMF_ANY);
+ void *mem = malloc(size);
if (mem) memset(mem, value, size);
return mem;
#endif
}
+/* Free special clear (ie. non-zero) area, which is different on OS3 and 4 */
+void ami_memory_clear_free(void *p)
+{
+#ifdef __amigaos4__
+ FreeVec(p);
+#else
+ free(p);
+#endif
+}
+
APTR ami_misc_itempool_create(int size)
{
#ifdef __amigaos4__
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 1c51f30..63452f6 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -21,8 +21,18 @@
#include <exec/types.h>
-/* Standard memory allocation */
-void *ami_misc_allocvec_clear(int size, UBYTE value);
+/* Alloc/free chip memory */
+#ifdef __amigaos4__
+#define ami_memory_chip_alloc(s) malloc(s)
+#define ami_memory_chip_free(p) free(p)
+#else
+#define ami_memory_chip_alloc(s) AllocVec(s, MEMF_CHIP)
+#define ami_memory_chip_free(p) FreeVec(p)
+#endif
+
+/* Alloc/free a block cleared to non-zero */
+void *ami_memory_clear_alloc(size_t size, UBYTE value);
+void ami_memory_clear_free(void *p);
/* Itempool cross-compatibility */
APTR ami_misc_itempool_create(int size);
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index feb5c29..dc5514b 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -68,7 +68,6 @@
#include "amiga/hotlist.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/print.h"
@@ -504,11 +503,11 @@ HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *)
ASLFR_InitialDrawer, nsoption_charp(arexx_dir),
ASLFR_InitialPattern, "#?.nsrx",
TAG_DONE)) {
- if((temp = AllocVecTagList(1024, NULL))) {
+ if((temp = malloc(1024))) {
strlcpy(temp, filereq->fr_Drawer, 1024);
AddPart(temp, filereq->fr_File, 1024);
ami_arexx_execute(temp);
- FreeVec(temp);
+ free(temp);
}
}
}
@@ -521,13 +520,13 @@ HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(script) {
- if((temp = AllocVecTagList(1024, NULL))) {
+ if((temp = malloc(1024))) {
BPTR lock;
if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
DevNameFromLock(lock, temp, 1024, DN_FULLPATH);
AddPart(temp, script, 1024);
ami_arexx_execute(temp);
- FreeVec(temp);
+ free(temp);
UnLock(lock);
}
}
@@ -560,7 +559,7 @@ void ami_free_menulabs(struct gui_window_2 *gwin)
gwin->menukey[i] = 0;
}
- FreeVec(gwin->menutype);
+ free(gwin->menutype);
gwin->menutype = NULL;
}
@@ -609,7 +608,7 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
{
int i;
- gwin->menutype = ami_misc_allocvec_clear(sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1), 0);
+ gwin->menutype = calloc(1, sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1));
for(i=0;i <= AMI_MENU_AREXX_MAX;i++)
{
@@ -936,7 +935,7 @@ void ami_menu_free(struct gui_window_2 *gwin)
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
- gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
+ gwin->menu = calloc(1, sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1));
ami_init_menulabs(gwin);
ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin);
ami_menu_arexx_scan(gwin);
@@ -959,7 +958,7 @@ struct Menu *ami_menu_create(struct gui_window_2 *gwin)
gwin->imenu = CreateMenus(gwin->menu, TAG_DONE);
LayoutMenus(gwin->imenu, gwin->vi,
GTMN_NewLookMenus, TRUE, TAG_DONE);
- FreeVec(gwin->menu); /**\todo this should be local to this function */
+ free(gwin->menu); /**\todo this should be local to this function */
gwin->menu = NULL;
return gwin->imenu;
@@ -978,7 +977,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin)
char *menu_lab;
if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
- if((buffer = AllocVecTagList(1024, NULL))) {
+ if((buffer = malloc(1024))) {
if((ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))) {
ctrl->eac_LastKey = 0;
@@ -1009,7 +1008,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin)
} while(cont);
FreeDosObject(DOS_EXALLCONTROL,ctrl);
}
- FreeVec(buffer);
+ free(buffer);
}
UnLock(lock);
}
diff --git a/frontends/amiga/object.c b/frontends/amiga/object.c
index 074ad92..c729e4a 100755
--- a/frontends/amiga/object.c
+++ b/frontends/amiga/object.c
@@ -62,7 +62,7 @@ static void ami_NewMinList(struct MinList *list)
/* Allocate and initialise a new MinList */
struct MinList *ami_AllocMinList(void)
{
- struct MinList *objlist = (struct MinList *)AllocVecTagList(sizeof(struct nsList), NULL);
+ struct MinList *objlist = (struct MinList *)malloc(sizeof(struct nsList));
if(objlist == NULL) return NULL;
ami_NewMinList(objlist);
return objlist;
@@ -98,7 +98,7 @@ static void DelObjectInternal(struct nsObject *dtzo, BOOL free_obj)
{
Remove((struct Node *)dtzo);
if(dtzo->callback != NULL) dtzo->callback(dtzo->objstruct);
- if(dtzo->objstruct && free_obj) FreeVec(dtzo->objstruct);
+ if(dtzo->objstruct && free_obj) free(dtzo->objstruct);
if(dtzo->dtz_Node.ln_Name) free(dtzo->dtz_Node.ln_Name);
ami_misc_itempool_free(pool_nsobj, dtzo, sizeof(struct nsObject));
dtzo = NULL;
@@ -131,6 +131,6 @@ void FreeObjList(struct MinList *objlist)
}
} while((node=nnode));
- FreeVec(objlist);
+ free(objlist);
}
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index bdf6333..c082602 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -46,6 +46,155 @@
#define FAILURE (FALSE)
#define NO !
+/* Utility */
+struct FormatContext
+{
+ STRPTR Index;
+ LONG Size;
+ BOOL Overflow;
+};
+
+STATIC VOID ASM
+StuffChar(
+ REG(a3, struct FormatContext * Context),
+ REG(d0, UBYTE Char))
+{
+ /* Is there still room? */
+ if(Context->Size > 0)
+ {
+ (*Context->Index) = Char;
+
+ Context->Index++;
+ Context->Size--;
+
+ /* Is there only a single character left? */
+ if(Context->Size == 1)
+ {
+ /* Provide null-termination. */
+ (*Context->Index) = '\0';
+
+ /* Don't store any further characters. */
+ Context->Size = 0;
+ }
+ }
+ else
+ {
+ Context->Overflow = TRUE;
+ }
+}
+
+BOOL
+VSPrintfN(
+ LONG MaxLen,
+ STRPTR Buffer,
+ const STRPTR FormatString,
+ const va_list VarArgs)
+{
+ BOOL result = FAILURE;
+
+ /* format a text, but place only up to MaxLen
+ * characters in the output buffer (including
+ * the terminating NUL)
+ */
+
+ if (Buffer == NULL || FormatString == NULL) return(result);
+
+ if(MaxLen > 1)
+ {
+ struct FormatContext Context;
+
+ Context.Index = Buffer;
+ Context.Size = MaxLen;
+ Context.Overflow = FALSE;
+
+ RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
+
+ if(NO Context.Overflow)
+ result = SUCCESS;
+ }
+
+ return(result);
+}
+
+BOOL
+SPrintfN(
+ LONG MaxLen,
+ STRPTR Buffer,
+ const STRPTR FormatString,
+ ...)
+{
+ va_list VarArgs;
+ BOOL result = FAILURE;
+
+ /* format a text, varargs version */
+
+ if (Buffer == NULL && FormatString == NULL) return result;
+
+ va_start(VarArgs,FormatString);
+ result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
+ va_end(VarArgs);
+
+ return(result);
+}
+
+char *ASPrintf(const char *fmt, ...)
+{
+ int r;
+ va_list ap;
+ static char buffer[2048];
+ char *rbuf;
+
+ va_start(ap, fmt);
+ r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
+ va_end(ap);
+
+ r = strlen(buffer);
+ rbuf = AllocVec(r+1, MEMF_CLEAR);
+ if (rbuf != NULL)
+ {
+ strncpy(rbuf, buffer, r);
+ }
+ return rbuf;
+}
+
+/* C */
+char *strlwr(char *str)
+{
+ size_t i;
+ size_t len = strlen(str);
+
+ for(i=0; i<len; i++)
+ str[i] = tolower((unsigned char)str[i]);
+
+ return str;
+}
+
+char *strsep(char **s1, const char *s2)
+{
+ char *const p1 = *s1;
+
+ if (p1 != NULL) {
+ *s1 = strpbrk(p1, s2);
+ if (*s1 != NULL) {
+ *(*s1)++ = '\0';
+ }
+ }
+ return p1;
+}
+
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **))
+{
+ /*\todo stub function, needs writing, preferably into clib2 */
+ return 0;
+}
+
+long long int strtoll(const char *nptr, char **endptr, int base)
+{
+ return (long long int)strtol(nptr, endptr, base);
+}
+
/* Diskfont */
struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
{
@@ -99,7 +248,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
}
size = GetFileSize(fh);
- buffer = (UBYTE *)AllocVec(size, MEMF_ANY);
+ buffer = (UBYTE *)malloc(size);
if(buffer == NULL) {
LOG("Unable to allocate memory");
Close(fh);
@@ -114,7 +263,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
struct TagItem *tag = (struct TagItem *)buffer;
if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) {
LOG("Invalid OTAG file");
- FreeVec(buffer);
+ free(buffer);
FreeVec(otagpath);
return NULL;
}
@@ -132,7 +281,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
fname = ASPrintf("%s.library", ti->ti_Data);
} else {
LOG("Cannot find OT_Engine tag");
- FreeVec(buffer);
+ free(buffer);
FreeVec(otagpath);
return NULL;
}
@@ -141,7 +290,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
if(BulletBase == NULL) {
LOG("Unable to open font engine %s", fname);
- FreeVec(buffer);
+ free(buffer);
FreeVec(fname);
FreeVec(otagpath);
}
@@ -155,7 +304,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
OT_OTagList, (ULONG)buffer,
TAG_DONE);
- of = AllocVec(sizeof(struct OutlineFont), MEMF_CLEAR);
+ of = calloc(1, sizeof(struct OutlineFont));
if(of == NULL) return NULL;
of->BulletBase = BulletBase;
@@ -174,8 +323,8 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
CloseLibrary((struct Library *)BulletBase);
FreeVec(of->OTagPath);
- FreeVec(of->olf_OTagList);
- FreeVec(of);
+ free(of->olf_OTagList);
+ free(of);
}
@@ -183,13 +332,13 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
int64 GetFileSize(BPTR fh)
{
int32 size = 0;
- struct FileInfoBlock *fib = AllocVec(sizeof(struct FileInfoBlock), MEMF_ANY);
+ struct FileInfoBlock *fib = malloc(sizeof(struct FileInfoBlock));
if(fib == NULL) return 0;
ExamineFH(fh, fib);
size = fib->fib_Size;
- FreeVec(fib);
+ free(fib);
return (int64)size;
}
@@ -280,155 +429,5 @@ APTR NewObject(struct IClass * classPtr, CONST_STRPTR classID, ULONG tagList, ..
{
return NewObjectA(classPtr, classID, (const struct TagItem *) &tagList);
}
-
-/* Utility */
-struct FormatContext
-{
- STRPTR Index;
- LONG Size;
- BOOL Overflow;
-};
-
-STATIC VOID ASM
-StuffChar(
- REG(a3, struct FormatContext * Context),
- REG(d0, UBYTE Char))
-{
- /* Is there still room? */
- if(Context->Size > 0)
- {
- (*Context->Index) = Char;
-
- Context->Index++;
- Context->Size--;
-
- /* Is there only a single character left? */
- if(Context->Size == 1)
- {
- /* Provide null-termination. */
- (*Context->Index) = '\0';
-
- /* Don't store any further characters. */
- Context->Size = 0;
- }
- }
- else
- {
- Context->Overflow = TRUE;
- }
-}
-
-BOOL
-VSPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- const va_list VarArgs)
-{
- BOOL result = FAILURE;
-
- /* format a text, but place only up to MaxLen
- * characters in the output buffer (including
- * the terminating NUL)
- */
-
- if (Buffer == NULL || FormatString == NULL) return(result);
-
- if(MaxLen > 1)
- {
- struct FormatContext Context;
-
- Context.Index = Buffer;
- Context.Size = MaxLen;
- Context.Overflow = FALSE;
-
- RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
-
- if(NO Context.Overflow)
- result = SUCCESS;
- }
-
- return(result);
-}
-
-BOOL
-SPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- ...)
-{
- va_list VarArgs;
- BOOL result = FAILURE;
-
- /* format a text, varargs version */
-
- if (Buffer == NULL && FormatString == NULL) return result;
-
- va_start(VarArgs,FormatString);
- result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
- va_end(VarArgs);
-
- return(result);
-}
-
-char *ASPrintf(const char *fmt, ...)
-{
- int r;
- va_list ap;
- static char buffer[2048];
- char *rbuf;
-
- va_start(ap, fmt);
- r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
- va_end(ap);
-
- r = strlen(buffer);
- rbuf = AllocVec(r+1, MEMF_CLEAR);
- if (rbuf != NULL)
- {
- strncpy(rbuf, buffer, r);
- }
- return rbuf;
-}
-
-/* C */
-char *strlwr(char *str)
-{
- size_t i;
- size_t len = strlen(str);
-
- for(i=0; i<len; i++)
- str[i] = tolower((unsigned char)str[i]);
-
- return str;
-}
-
-char *strsep(char **s1, const char *s2)
-{
- char *const p1 = *s1;
-
- if (p1 != NULL) {
- *s1 = strpbrk(p1, s2);
- if (*s1 != NULL) {
- *(*s1)++ = '\0';
- }
- }
- return p1;
-}
-
-int scandir(const char *dir, struct dirent ***namelist,
- int (*filter)(const struct dirent *),
- int (*compar)(const struct dirent **, const struct dirent **))
-{
- /*\todo stub function, needs writing, preferably into clib2 */
- return 0;
-}
-
-long long int strtoll(const char *nptr, char **endptr, int base)
-{
- return (long long int)strtol(nptr, endptr, base);
-}
-
#endif
diff --git a/frontends/amiga/os3support.h b/frontends/amiga/os3support.h
index 94d1d58..856439b 100644
--- a/frontends/amiga/os3support.h
+++ b/frontends/amiga/os3support.h
@@ -152,7 +152,6 @@
#define DevNameFromLock(A,B,C,D) NameFromLock(A,B,C)
/* Exec */
-#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
#define FindIName FindName
/* Intuition */
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 073a95f..f9fa62a 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -33,6 +33,7 @@
#include <math.h>
#include <assert.h>
+#include <stdlib.h>
#include "utils/nsoption.h"
#include "utils/utils.h"
@@ -146,14 +147,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->height = height;
gg->layerinfo = NewLayerInfo();
- gg->areabuf = AllocVecTagList(AREA_SIZE, NULL);
+ gg->areabuf = malloc(AREA_SIZE);
-#ifdef __amigaos4__
- gg->tmprasbuf = AllocVecTagList(width * height, NULL);
-#else
/* OS3/AGA requires this to be in chip mem. RTG would probably rather it wasn't. */
- gg->tmprasbuf = AllocVec(width * height, MEMF_CHIP);
-#endif
+ gg->tmprasbuf = ami_memory_chip_alloc(width * height);
if(gg->palette_mapped == true) {
gg->bm = AllocBitMap(width, height, depth, 0, friend);
@@ -172,7 +169,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
if(!gg->bm) amiga_warn_user("NoMemory","");
- gg->rp = AllocVecTagList(sizeof(struct RastPort), NULL);
+ gg->rp = malloc(sizeof(struct RastPort));
if(!gg->rp) amiga_warn_user("NoMemory","");
InitRastPort(gg->rp);
@@ -185,12 +182,12 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
InstallLayerHook(gg->rp->Layer,LAYERS_NOBACKFILL);
- gg->rp->AreaInfo = AllocVecTagList(sizeof(struct AreaInfo), NULL);
+ gg->rp->AreaInfo = malloc(sizeof(struct AreaInfo));
if((!gg->areabuf) || (!gg->rp->AreaInfo)) amiga_warn_user("NoMemory","");
- InitArea(gg->rp->AreaInfo,gg->areabuf, AREA_SIZE/5);
+ InitArea(gg->rp->AreaInfo, gg->areabuf, AREA_SIZE/5);
- gg->rp->TmpRas = AllocVecTagList(sizeof(struct TmpRas), NULL);
+ gg->rp->TmpRas = malloc(sizeof(struct TmpRas));
if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) amiga_warn_user("NoMemory","");
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
@@ -219,13 +216,13 @@ void ami_free_layers(struct gui_globals *gg)
if(gg->rp) {
DeleteLayer(0,gg->rp->Layer);
- FreeVec(gg->rp->TmpRas);
- FreeVec(gg->rp->AreaInfo);
- FreeVec(gg->rp);
+ free(gg->rp->TmpRas);
+ free(gg->rp->AreaInfo);
+ free(gg->rp);
}
- FreeVec(gg->tmprasbuf);
- FreeVec(gg->areabuf);
+ ami_memory_chip_free(gg->tmprasbuf);
+ free(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
if(gg->palette_mapped == false) {
if(gg->bm) ami_rtg_freebitmap(gg->bm);
@@ -713,7 +710,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
bfbm.offsetx = ox;
bfbm.offsety = oy;
bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
- bfh = ami_misc_allocvec_clear(sizeof(struct Hook), 0); /* NB: Was not MEMF_PRIVATE */
+ bfh = calloc(1, sizeof(struct Hook));
bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
bfh->h_SubEntry = 0;
bfh->h_Data = &bfbm;
@@ -727,7 +724,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
else
#endif
- FreeVec(bfh);
+ free(bfh);
if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
/**\todo is this logic logical? */
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 7c0dfd9..25a4c32 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -62,7 +62,6 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/print.h"
#include "amiga/utf8.h"
@@ -134,11 +133,11 @@ static void ami_print_ui_free(void)
int i;
for(i = 0; i < PGID_LAST; i++) {
- if(gadlab[i]) FreeVec((APTR)gadlab[i]);
+ if(gadlab[i]) free((APTR)gadlab[i]);
}
for(i = 0; i < 10; i++) {
- if(printers[i]) FreeVec(printers[i]);
+ if(printers[i]) free(printers[i]);
}
}
@@ -228,21 +227,21 @@ void ami_print_ui(struct hlcache_handle *c)
char filename[30];
int i;
- struct ami_print_window *pw = ami_misc_allocvec_clear(sizeof(struct ami_print_window), 0);
+ struct ami_print_window *pw = calloc(1, sizeof(struct ami_print_window));
pw->c = c;
- printers[0] = ami_misc_allocvec_clear(50, 0);
+ printers[0] = calloc(1, 50);
ami_print_readunit("ENV:Sys/printer.prefs", printers[0], 50, 0);
strcpy(filename,"ENV:Sys/printerN.prefs");
for (i = 1; i < 10; i++)
{
filename[15] = '0' + i;
- printers[i] = AllocVecTagList(50, NULL);
+ printers[i] = malloc(50);
if(!ami_print_readunit(filename, printers[i], 50, i))
{
- FreeVec(printers[i]);
+ free(printers[i]);
printers[i] = NULL;
break;
}
@@ -483,7 +482,7 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
+ ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
if(!ami_print_info.gg) return false;
ami_init_layers(ami_print_info.gg,
@@ -510,7 +509,7 @@ bool ami_print_next_page(void)
void ami_print_end(void)
{
ami_free_layers(ami_print_info.gg);
- FreeVec(ami_print_info.gg);
+ free(ami_print_info.gg);
DisposeObject(ami_print_info.objects[OID_MAIN]);
ami_gui_set_default_gg();
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 7a49919..cd5ab5e 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -27,6 +27,7 @@
#include "utils/config.h"
#include <ctype.h>
#include <string.h>
+#include <stdlib.h>
#include <proto/intuition.h>
#include <proto/exec.h>
@@ -122,7 +123,7 @@ void ami_search_open(struct gui_window *gwin)
return;
}
- fwin = ami_misc_allocvec_clear(sizeof(struct find_window), 0);
+ fwin = calloc(1, sizeof(struct find_window));
fwin->objects[OID_MAIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 5f44a9b..496fc54 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -49,7 +49,7 @@
#include "amiga/bitmap.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
-#include "amiga/memory.h"
+#include "amiga/misc.h"
static struct BitMap *throbber = NULL;
static struct bitmap *throbber_nsbm = NULL;
@@ -363,13 +363,13 @@ void ami_init_mouse_pointers(void)
if((ptrfile = Open(ptrfname,MODE_OLDFILE)))
{
int mx,my;
- UBYTE *pprefsbuf = AllocVecTagList(1061, NULL);
- Read(ptrfile,pprefsbuf,1061);
+ UBYTE *pprefsbuf = malloc(1061);
+ Read(ptrfile, pprefsbuf, 1061);
- mouseptrbm[i]=AllocVecTagList(sizeof(struct BitMap), NULL);
- InitBitMap(mouseptrbm[i],2,32,32);
- mouseptrbm[i]->Planes[0] = AllocRaster(32,32);
- mouseptrbm[i]->Planes[1] = AllocRaster(32,32);
+ mouseptrbm[i] = malloc(sizeof(struct BitMap));
+ InitBitMap(mouseptrbm[i], 2, 32, 32);
+ mouseptrbm[i]->Planes[0] = AllocRaster(32, 32);
+ mouseptrbm[i]->Planes[1] = AllocRaster(32, 32);
mouseptr.BitMap = mouseptrbm[i];
for(my=0;my<32;my++)
@@ -393,7 +393,7 @@ void ami_init_mouse_pointers(void)
POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
TAG_DONE);
- FreeVec(pprefsbuf);
+ free(pprefsbuf);
Close(ptrfile);
}
@@ -414,7 +414,7 @@ void ami_mouse_pointers_free(void)
{
FreeRaster(mouseptrbm[i]->Planes[0],32,32);
FreeRaster(mouseptrbm[i]->Planes[1],32,32);
- FreeVec(mouseptrbm[i]);
+ free(mouseptrbm[i]);
}
}
}
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index eea64ff..9049709 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -66,7 +66,6 @@
#include "amiga/tree.h"
#include "amiga/file.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
@@ -133,8 +132,8 @@ static void ami_tree_get_window_dimensions(int *width, int *height, void *data);
void ami_tree_destroy(struct treeview_window *twin)
{
tree_delete(twin->tree);
- FreeVec(twin->shared_pens);
- FreeVec(twin);
+ free(twin->shared_pens);
+ free(twin);
}
struct tree *ami_tree_get_tree(struct treeview_window *twin)
@@ -258,7 +257,7 @@ static void ami_tree_redraw_req_dr(void *p)
atrr_data->x, atrr_data->y,
atrr_data->width, atrr_data->height, &ctx);
- FreeVec(atrr_data);
+ free(atrr_data);
ami_gui_free_space_box(bbox);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
ami_clearclipreg(glob);
@@ -342,7 +341,7 @@ static void ami_tree_redraw_req(void *p)
}
}
- FreeVec(atrr_data);
+ free(atrr_data);
ami_gui_free_space_box(bbox);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
ami_clearclipreg(glob);
@@ -351,7 +350,7 @@ static void ami_tree_redraw_req(void *p)
static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
{
- struct ami_tree_redraw_req *atrr_data = AllocVecTagList(sizeof(struct ami_tree_redraw_req), NULL);
+ struct ami_tree_redraw_req *atrr_data = malloc(sizeof(struct ami_tree_redraw_req));
atrr_data->x = x;
atrr_data->y = y;
@@ -563,7 +562,7 @@ static void ami_tree_menu(struct treeview_window *twin)
{
if(twin->menu) return;
- if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) {
+ if((twin->menu = calloc(1, sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS))) {
twin->menu[0].nm_Type = NM_TITLE;
twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree"));
twin->menu[0].nm_Label = twin->menu_name[0];
@@ -900,7 +899,7 @@ void ami_tree_close(struct treeview_window *twin)
twin->menu_name[i] = NULL;
}
- FreeVec(twin->menu);
+ free(twin->menu);
twin->menu = NULL;
ami_utf8_free(twin->wintitle);
twin->wintitle = NULL;
@@ -1456,7 +1455,7 @@ struct treeview_window *ami_tree_create(int flags,
{
struct treeview_window *twin;
- twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0);
+ twin = calloc(1, sizeof(struct treeview_window));
if(!twin)
{
diff --git a/frontends/amiga/version.c b/frontends/amiga/version.c
index f7ecc2e..c3cd9e2 100644
--- a/frontends/amiga/version.c
+++ b/frontends/amiga/version.c
@@ -18,14 +18,14 @@
#include "testament.h"
-/* NB: AmigaOS revision numbers start at 1 (not 0) and are monotonically
- * incremental (v1.20 is higher than v1.3 and not the same as v1.2).
- * Consequently, this version pair may not match the user-facing one in
- * desktop/version.c. Release revisions are prepended with 6000 to ensure
- * they are higher than CI builds, and make this (slightly) less confusing.
+/* Release revisions are prepended with 6000 so the version numbers below
+ * are same as NetSurf numbering.
+ * CI builds use themselves as the revision.
+ * This means releases have a higher revision than CI builds, and stops
+ * problems created by "0" not being a valid AmigaOS revision number.
*/
#define NETSURF_VERSION_MAJOR "3"
-#define NETSURF_VERSION_MINOR_EXTERNAL "8"
+#define NETSURF_VERSION_MINOR_EXTERNAL "7"
#if defined(CI_BUILD)
#define NETSURF_VERSION_MINOR CI_BUILD
#else
--
NetSurf Browser
6 years, 4 months
netsurf: branch chris/malloc updated. release/3.6-18-geab6c0c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/eab6c0c99e29e10a3ac40...
...commit http://git.netsurf-browser.org/netsurf.git/commit/eab6c0c99e29e10a3ac409b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/eab6c0c99e29e10a3ac409b8d...
The branch, chris/malloc has been updated
via eab6c0c99e29e10a3ac409b8de7c0e39ef918358 (commit)
via 15a68714919c64edc04d6e26679fabb490bdf9a2 (commit)
via 0513782fe3bb2884d0f63fb11c69f06055332388 (commit)
via 05fa29ba8bc2dbfaa9af7ed1263554c7cdc9214d (commit)
via 4f0c9b6c610d1eb9a5bcccf6dbf3f53410df9432 (commit)
via faf4c1fb6012941134046db14370f60748184b05 (commit)
via 61a00c3832332bc27b991d3e20702a7f900e5098 (commit)
from 2c6f2f4ef5a50c36676308f6663c0d21edc6aa70 (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=eab6c0c99e29e10a3ac...
commit eab6c0c99e29e10a3ac409b8de7c0e39ef918358
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
remove ami_misc_allocvec_clear
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 3175cf1..a486334 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -46,7 +46,6 @@
#include "amiga/bitmap.h"
#include "amiga/filetype.h"
#include "amiga/datatypes.h"
-#include "amiga/memory.h"
#include "amiga/plotters.h"
typedef struct amiga_dt_anim_content {
@@ -216,7 +215,7 @@ bool amiga_dt_anim_convert(struct content *c)
#else
#warning FIXME: Need to use a different blitter function for OS3!
#endif
- FreeVec(clut);
+ free(clut);
adt_frame.MethodID = ADTM_UNLOADFRAME;
IDoMethodA(plugin->dto, (Msg)&adt_frame);
@@ -344,7 +343,7 @@ content_type amiga_dt_anim_content_type(void)
static APTR ami_colormap_to_clut(struct ColorMap *cmap)
{
int i;
- UBYTE *clut = ami_misc_allocvec_clear(256 * 4, 0); /* NB: Was not MEMF_PRIVATE */
+ UBYTE *clut = calloc(1, 256 * 4);
ULONG colr[256 * 4];
if(!clut) return NULL;
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 567f4f5..7a34f7a 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -47,17 +47,6 @@ void ami_memory_clear_free(void *p)
#endif
}
-void *ami_misc_allocvec_clear(int size, UBYTE value)
-{
-#ifdef __amigaos4__
- return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
-#else
- void *mem = AllocVec(size, MEMF_ANY);
- if (mem) memset(mem, value, size);
- return mem;
-#endif
-}
-
APTR ami_misc_itempool_create(int size)
{
#ifdef __amigaos4__
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index dd36a21..63452f6 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -34,9 +34,6 @@
void *ami_memory_clear_alloc(size_t size, UBYTE value);
void ami_memory_clear_free(void *p);
-/* Standard memory allocation - to be removed */
-void *ami_misc_allocvec_clear(int size, UBYTE value);
-
/* Itempool cross-compatibility */
APTR ami_misc_itempool_create(int size);
void ami_misc_itempool_delete(APTR pool);
diff --git a/frontends/amiga/os3support.h b/frontends/amiga/os3support.h
index 94d1d58..856439b 100644
--- a/frontends/amiga/os3support.h
+++ b/frontends/amiga/os3support.h
@@ -152,7 +152,6 @@
#define DevNameFromLock(A,B,C,D) NameFromLock(A,B,C)
/* Exec */
-#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
#define FindIName FindName
/* Intuition */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=15a68714919c64edc04...
commit 15a68714919c64edc04d6e26679fabb490bdf9a2
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Add missing includes
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 24eb9ac..ecc36fa 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -140,6 +140,7 @@
#include "amiga/launch.h"
#include "amiga/libs.h"
#include "amiga/login.h"
+#include "amiga/memory.h"
#include "amiga/menu.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index 29bb72b..91973f4 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -19,6 +19,7 @@
#ifdef WITH_NS_SVG
#include <stdio.h>
+#include <stdlib.h>
#include <inttypes.h>
#include <svgtiny.h>
#include <proto/exec.h>
diff --git a/frontends/amiga/object.c b/frontends/amiga/object.c
index 98e0b12..c729e4a 100755
--- a/frontends/amiga/object.c
+++ b/frontends/amiga/object.c
@@ -26,6 +26,7 @@
#include <exec/lists.h>
#include <exec/nodes.h>
+#include "amiga/memory.h"
#include "amiga/object.h"
#ifdef __amigaos4__
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 8d7ddcd..f9fa62a 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -33,6 +33,7 @@
#include <math.h>
#include <assert.h>
+#include <stdlib.h>
#include "utils/nsoption.h"
#include "utils/utils.h"
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 7725e86..cd5ab5e 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -27,6 +27,7 @@
#include "utils/config.h"
#include <ctype.h>
#include <string.h>
+#include <stdlib.h>
#include <proto/intuition.h>
#include <proto/exec.h>
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 5e94ca2..496fc54 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -49,7 +49,7 @@
#include "amiga/bitmap.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
-#include "amiga/memory.h"
+#include "amiga/misc.h"
static struct BitMap *throbber = NULL;
static struct bitmap *throbber_nsbm = NULL;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0513782fe3bb2884d0f...
commit 0513782fe3bb2884d0f63fb11c69f06055332388
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Correct revision number
I think my note about AmigaOS version numbering was misleading.
diff --git a/frontends/amiga/version.c b/frontends/amiga/version.c
index f7ecc2e..c3cd9e2 100644
--- a/frontends/amiga/version.c
+++ b/frontends/amiga/version.c
@@ -18,14 +18,14 @@
#include "testament.h"
-/* NB: AmigaOS revision numbers start at 1 (not 0) and are monotonically
- * incremental (v1.20 is higher than v1.3 and not the same as v1.2).
- * Consequently, this version pair may not match the user-facing one in
- * desktop/version.c. Release revisions are prepended with 6000 to ensure
- * they are higher than CI builds, and make this (slightly) less confusing.
+/* Release revisions are prepended with 6000 so the version numbers below
+ * are same as NetSurf numbering.
+ * CI builds use themselves as the revision.
+ * This means releases have a higher revision than CI builds, and stops
+ * problems created by "0" not being a valid AmigaOS revision number.
*/
#define NETSURF_VERSION_MAJOR "3"
-#define NETSURF_VERSION_MINOR_EXTERNAL "8"
+#define NETSURF_VERSION_MINOR_EXTERNAL "7"
#if defined(CI_BUILD)
#define NETSURF_VERSION_MINOR CI_BUILD
#else
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=05fa29ba8bc2dbfaa9a...
commit 05fa29ba8bc2dbfaa9af7ed1263554c7cdc9214d
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
more allocvec/malloc changes
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index bb4bfc6..27ffee4 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -737,7 +737,7 @@ void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
void ami_bitmap_free_icondata(struct bitmap *bm)
{
- if(bm->icondata) FreeVec(bm->icondata);
+ if(bm->icondata) free(bm->icondata);
bm->icondata = NULL;
}
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index f0abd4c..db3fef20 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -176,9 +176,11 @@ extern struct Screen *scrn;
extern struct MsgPort *sport;
extern struct gui_window *cur_gw;
-/* The return value must be deallocated using FreeVec() */
+/* The return value for these functions must be deallocated using FreeVec() */
STRPTR ami_locale_langs(int *codeset);
+char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
+/* Functions lacking documentation */
void ami_get_msg(void);
void ami_try_quit(void);
void ami_quit_netsurf(void);
@@ -194,7 +196,6 @@ void ami_gui_tabs_toggle_all(void);
bool ami_locate_resource(char *fullpath, const char *file);
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
-char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
int ami_gui_count_windows(int window, int *tabs);
void ami_gui_set_scale(struct gui_window *gw, float scale);
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index 1c8d7db..29bb72b 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -30,11 +30,9 @@
#include "netsurf/content.h"
#include "amiga/os3support.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/memory.h"
#else
#include "os3support.h"
#include "iff_dr2d.h"
-#include "misc.h"
#endif
static struct ColorRegister cm[1000];
@@ -171,7 +169,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
}
for (unsigned int i = 0; i != diagram->shape_count; i++) {
- attr = ami_misc_allocvec_clear(sizeof(struct attr_struct), 0);
+ attr = calloc(1, sizeof(struct attr_struct));
if (diagram->shape[i].fill == svgtiny_TRANSPARENT)
attr->FillType = FT_NONE;
else
@@ -193,7 +191,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
WriteChunkBytes(iffh,attr,14);
PopChunk(iffh);
}
- FreeVec(attr);
+ free(attr);
if (diagram->shape[i].path) {
union {
@@ -272,30 +270,30 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
PopChunk(iffh);
}
} else if (diagram->shape[i].text) {
- stxt = ami_misc_allocvec_clear(sizeof(struct stxt_struct), 0);
+ stxt = calloc(1, sizeof(struct stxt_struct));
stxt->BaseX = diagram->shape[i].text_x;
stxt->BaseY = diagram->shape[i].text_y;
stxt->NumChars = strlen(diagram->shape[i].text);
if(!fons_written)
{
- fons = ami_misc_allocvec_clear(sizeof(struct fons_struct), 0);
- if(!(PushChunk(iffh,0,ID_FONS,IFFSIZE_UNKNOWN)))
+ fons = calloc(1, sizeof(struct fons_struct));
+ if(!(PushChunk(iffh, 0, ID_FONS, IFFSIZE_UNKNOWN)))
{
WriteChunkBytes(iffh, fons, sizeof(struct fons_struct));
WriteChunkBytes(iffh, "Topaz\0", 6);
PopChunk(iffh);
}
- FreeVec(fons);
+ free(fons);
fons_written = TRUE;
}
- if(!(PushChunk(iffh,0,ID_STXT,IFFSIZE_UNKNOWN)))
+ if(!(PushChunk(iffh, 0, ID_STXT, IFFSIZE_UNKNOWN)))
{
- WriteChunkBytes(iffh,stxt,26);
- WriteChunkBytes(iffh,diagram->shape[i].text,strlen(diagram->shape[i].text));
+ WriteChunkBytes(iffh, stxt, 26);
+ WriteChunkBytes(iffh, diagram->shape[i].text, strlen(diagram->shape[i].text));
PopChunk(iffh);
}
- FreeVec(stxt);
+ free(stxt);
}
}
@@ -380,7 +378,7 @@ int main(int argc, char **argv)
{
size = GetFileSize(fh);
- buffer = AllocVecTagList((uint32_t)size, NULL);
+ buffer = malloc((uint32_t)size);
Read(fh,buffer,(uint32_t)size);
Close(fh);
@@ -404,7 +402,7 @@ int main(int argc, char **argv)
ami_svg_to_dr2d(iffh,buffer,size,(char *)rarray[A_SVG]);
- FreeVec(buffer);
+ free(buffer);
if(iffh) CloseIFF(iffh);
if(iffh->iff_Stream) Close((BPTR)iffh->iff_Stream);
if(iffh) FreeIFF(iffh);
diff --git a/frontends/amiga/launch.c b/frontends/amiga/launch.c
index 8020dd6..31800ef 100755
--- a/frontends/amiga/launch.c
+++ b/frontends/amiga/launch.c
@@ -50,10 +50,10 @@ static struct ami_protocol *ami_openurl_add_protocol(const char *url)
{
nsurl *ns_url;
struct ami_protocol *ami_p =
- (struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
+ (struct ami_protocol *)malloc(sizeof(struct ami_protocol));
if (nsurl_create(url, &ns_url) != NSERROR_OK) {
- FreeVec(ami_p);
+ free(ami_p);
return NULL;
}
@@ -61,7 +61,7 @@ static struct ami_protocol *ami_openurl_add_protocol(const char *url)
nsurl_unref(ns_url);
if (ami_p->protocol == NULL)
{
- FreeVec(ami_p);
+ free(ami_p);
return NULL;
}
@@ -83,11 +83,11 @@ static void ami_openurl_free_list(struct MinList *list)
Remove((struct Node *)node);
if (node->protocol) lwc_string_unref(node->protocol);
- FreeVec(node);
+ free(node);
node = NULL;
}while((node=nnode));
- FreeVec(list);
+ free(list);
}
static BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index e1d2891..805e25c 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,7 +46,6 @@
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/object.h"
#include "amiga/login.h"
@@ -67,7 +66,7 @@ void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
const char *auth;
- struct gui_login_window *lw = ami_misc_allocvec_clear(sizeof(struct gui_login_window), 0);
+ struct gui_login_window *lw = calloc(1, sizeof(struct gui_login_window));
lwc_string *host = nsurl_get_component(url, NSURL_HOST);
assert(host != NULL);
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 5e62864..dd36a21 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -22,8 +22,13 @@
#include <exec/types.h>
/* Alloc/free chip memory */
+#ifdef __amigaos4__
+#define ami_memory_chip_alloc(s) malloc(s)
+#define ami_memory_chip_free(p) free(p)
+#else
#define ami_memory_chip_alloc(s) AllocVec(s, MEMF_CHIP)
#define ami_memory_chip_free(p) FreeVec(p)
+#endif
/* Alloc/free a block cleared to non-zero */
void *ami_memory_clear_alloc(size_t size, UBYTE value);
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index feb5c29..dc5514b 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -68,7 +68,6 @@
#include "amiga/hotlist.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/print.h"
@@ -504,11 +503,11 @@ HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *)
ASLFR_InitialDrawer, nsoption_charp(arexx_dir),
ASLFR_InitialPattern, "#?.nsrx",
TAG_DONE)) {
- if((temp = AllocVecTagList(1024, NULL))) {
+ if((temp = malloc(1024))) {
strlcpy(temp, filereq->fr_Drawer, 1024);
AddPart(temp, filereq->fr_File, 1024);
ami_arexx_execute(temp);
- FreeVec(temp);
+ free(temp);
}
}
}
@@ -521,13 +520,13 @@ HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(script) {
- if((temp = AllocVecTagList(1024, NULL))) {
+ if((temp = malloc(1024))) {
BPTR lock;
if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
DevNameFromLock(lock, temp, 1024, DN_FULLPATH);
AddPart(temp, script, 1024);
ami_arexx_execute(temp);
- FreeVec(temp);
+ free(temp);
UnLock(lock);
}
}
@@ -560,7 +559,7 @@ void ami_free_menulabs(struct gui_window_2 *gwin)
gwin->menukey[i] = 0;
}
- FreeVec(gwin->menutype);
+ free(gwin->menutype);
gwin->menutype = NULL;
}
@@ -609,7 +608,7 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
{
int i;
- gwin->menutype = ami_misc_allocvec_clear(sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1), 0);
+ gwin->menutype = calloc(1, sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1));
for(i=0;i <= AMI_MENU_AREXX_MAX;i++)
{
@@ -936,7 +935,7 @@ void ami_menu_free(struct gui_window_2 *gwin)
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
- gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
+ gwin->menu = calloc(1, sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1));
ami_init_menulabs(gwin);
ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin);
ami_menu_arexx_scan(gwin);
@@ -959,7 +958,7 @@ struct Menu *ami_menu_create(struct gui_window_2 *gwin)
gwin->imenu = CreateMenus(gwin->menu, TAG_DONE);
LayoutMenus(gwin->imenu, gwin->vi,
GTMN_NewLookMenus, TRUE, TAG_DONE);
- FreeVec(gwin->menu); /**\todo this should be local to this function */
+ free(gwin->menu); /**\todo this should be local to this function */
gwin->menu = NULL;
return gwin->imenu;
@@ -978,7 +977,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin)
char *menu_lab;
if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
- if((buffer = AllocVecTagList(1024, NULL))) {
+ if((buffer = malloc(1024))) {
if((ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))) {
ctrl->eac_LastKey = 0;
@@ -1009,7 +1008,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin)
} while(cont);
FreeDosObject(DOS_EXALLCONTROL,ctrl);
}
- FreeVec(buffer);
+ free(buffer);
}
UnLock(lock);
}
diff --git a/frontends/amiga/object.c b/frontends/amiga/object.c
index 074ad92..98e0b12 100755
--- a/frontends/amiga/object.c
+++ b/frontends/amiga/object.c
@@ -26,7 +26,6 @@
#include <exec/lists.h>
#include <exec/nodes.h>
-#include "amiga/memory.h"
#include "amiga/object.h"
#ifdef __amigaos4__
@@ -62,7 +61,7 @@ static void ami_NewMinList(struct MinList *list)
/* Allocate and initialise a new MinList */
struct MinList *ami_AllocMinList(void)
{
- struct MinList *objlist = (struct MinList *)AllocVecTagList(sizeof(struct nsList), NULL);
+ struct MinList *objlist = (struct MinList *)malloc(sizeof(struct nsList));
if(objlist == NULL) return NULL;
ami_NewMinList(objlist);
return objlist;
@@ -98,7 +97,7 @@ static void DelObjectInternal(struct nsObject *dtzo, BOOL free_obj)
{
Remove((struct Node *)dtzo);
if(dtzo->callback != NULL) dtzo->callback(dtzo->objstruct);
- if(dtzo->objstruct && free_obj) FreeVec(dtzo->objstruct);
+ if(dtzo->objstruct && free_obj) free(dtzo->objstruct);
if(dtzo->dtz_Node.ln_Name) free(dtzo->dtz_Node.ln_Name);
ami_misc_itempool_free(pool_nsobj, dtzo, sizeof(struct nsObject));
dtzo = NULL;
@@ -131,6 +130,6 @@ void FreeObjList(struct MinList *objlist)
}
} while((node=nnode));
- FreeVec(objlist);
+ free(objlist);
}
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index bdf6333..c082602 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -46,6 +46,155 @@
#define FAILURE (FALSE)
#define NO !
+/* Utility */
+struct FormatContext
+{
+ STRPTR Index;
+ LONG Size;
+ BOOL Overflow;
+};
+
+STATIC VOID ASM
+StuffChar(
+ REG(a3, struct FormatContext * Context),
+ REG(d0, UBYTE Char))
+{
+ /* Is there still room? */
+ if(Context->Size > 0)
+ {
+ (*Context->Index) = Char;
+
+ Context->Index++;
+ Context->Size--;
+
+ /* Is there only a single character left? */
+ if(Context->Size == 1)
+ {
+ /* Provide null-termination. */
+ (*Context->Index) = '\0';
+
+ /* Don't store any further characters. */
+ Context->Size = 0;
+ }
+ }
+ else
+ {
+ Context->Overflow = TRUE;
+ }
+}
+
+BOOL
+VSPrintfN(
+ LONG MaxLen,
+ STRPTR Buffer,
+ const STRPTR FormatString,
+ const va_list VarArgs)
+{
+ BOOL result = FAILURE;
+
+ /* format a text, but place only up to MaxLen
+ * characters in the output buffer (including
+ * the terminating NUL)
+ */
+
+ if (Buffer == NULL || FormatString == NULL) return(result);
+
+ if(MaxLen > 1)
+ {
+ struct FormatContext Context;
+
+ Context.Index = Buffer;
+ Context.Size = MaxLen;
+ Context.Overflow = FALSE;
+
+ RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
+
+ if(NO Context.Overflow)
+ result = SUCCESS;
+ }
+
+ return(result);
+}
+
+BOOL
+SPrintfN(
+ LONG MaxLen,
+ STRPTR Buffer,
+ const STRPTR FormatString,
+ ...)
+{
+ va_list VarArgs;
+ BOOL result = FAILURE;
+
+ /* format a text, varargs version */
+
+ if (Buffer == NULL && FormatString == NULL) return result;
+
+ va_start(VarArgs,FormatString);
+ result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
+ va_end(VarArgs);
+
+ return(result);
+}
+
+char *ASPrintf(const char *fmt, ...)
+{
+ int r;
+ va_list ap;
+ static char buffer[2048];
+ char *rbuf;
+
+ va_start(ap, fmt);
+ r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
+ va_end(ap);
+
+ r = strlen(buffer);
+ rbuf = AllocVec(r+1, MEMF_CLEAR);
+ if (rbuf != NULL)
+ {
+ strncpy(rbuf, buffer, r);
+ }
+ return rbuf;
+}
+
+/* C */
+char *strlwr(char *str)
+{
+ size_t i;
+ size_t len = strlen(str);
+
+ for(i=0; i<len; i++)
+ str[i] = tolower((unsigned char)str[i]);
+
+ return str;
+}
+
+char *strsep(char **s1, const char *s2)
+{
+ char *const p1 = *s1;
+
+ if (p1 != NULL) {
+ *s1 = strpbrk(p1, s2);
+ if (*s1 != NULL) {
+ *(*s1)++ = '\0';
+ }
+ }
+ return p1;
+}
+
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **))
+{
+ /*\todo stub function, needs writing, preferably into clib2 */
+ return 0;
+}
+
+long long int strtoll(const char *nptr, char **endptr, int base)
+{
+ return (long long int)strtol(nptr, endptr, base);
+}
+
/* Diskfont */
struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
{
@@ -99,7 +248,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
}
size = GetFileSize(fh);
- buffer = (UBYTE *)AllocVec(size, MEMF_ANY);
+ buffer = (UBYTE *)malloc(size);
if(buffer == NULL) {
LOG("Unable to allocate memory");
Close(fh);
@@ -114,7 +263,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
struct TagItem *tag = (struct TagItem *)buffer;
if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) {
LOG("Invalid OTAG file");
- FreeVec(buffer);
+ free(buffer);
FreeVec(otagpath);
return NULL;
}
@@ -132,7 +281,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
fname = ASPrintf("%s.library", ti->ti_Data);
} else {
LOG("Cannot find OT_Engine tag");
- FreeVec(buffer);
+ free(buffer);
FreeVec(otagpath);
return NULL;
}
@@ -141,7 +290,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
if(BulletBase == NULL) {
LOG("Unable to open font engine %s", fname);
- FreeVec(buffer);
+ free(buffer);
FreeVec(fname);
FreeVec(otagpath);
}
@@ -155,7 +304,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
OT_OTagList, (ULONG)buffer,
TAG_DONE);
- of = AllocVec(sizeof(struct OutlineFont), MEMF_CLEAR);
+ of = calloc(1, sizeof(struct OutlineFont));
if(of == NULL) return NULL;
of->BulletBase = BulletBase;
@@ -174,8 +323,8 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
CloseLibrary((struct Library *)BulletBase);
FreeVec(of->OTagPath);
- FreeVec(of->olf_OTagList);
- FreeVec(of);
+ free(of->olf_OTagList);
+ free(of);
}
@@ -183,13 +332,13 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
int64 GetFileSize(BPTR fh)
{
int32 size = 0;
- struct FileInfoBlock *fib = AllocVec(sizeof(struct FileInfoBlock), MEMF_ANY);
+ struct FileInfoBlock *fib = malloc(sizeof(struct FileInfoBlock));
if(fib == NULL) return 0;
ExamineFH(fh, fib);
size = fib->fib_Size;
- FreeVec(fib);
+ free(fib);
return (int64)size;
}
@@ -280,155 +429,5 @@ APTR NewObject(struct IClass * classPtr, CONST_STRPTR classID, ULONG tagList, ..
{
return NewObjectA(classPtr, classID, (const struct TagItem *) &tagList);
}
-
-/* Utility */
-struct FormatContext
-{
- STRPTR Index;
- LONG Size;
- BOOL Overflow;
-};
-
-STATIC VOID ASM
-StuffChar(
- REG(a3, struct FormatContext * Context),
- REG(d0, UBYTE Char))
-{
- /* Is there still room? */
- if(Context->Size > 0)
- {
- (*Context->Index) = Char;
-
- Context->Index++;
- Context->Size--;
-
- /* Is there only a single character left? */
- if(Context->Size == 1)
- {
- /* Provide null-termination. */
- (*Context->Index) = '\0';
-
- /* Don't store any further characters. */
- Context->Size = 0;
- }
- }
- else
- {
- Context->Overflow = TRUE;
- }
-}
-
-BOOL
-VSPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- const va_list VarArgs)
-{
- BOOL result = FAILURE;
-
- /* format a text, but place only up to MaxLen
- * characters in the output buffer (including
- * the terminating NUL)
- */
-
- if (Buffer == NULL || FormatString == NULL) return(result);
-
- if(MaxLen > 1)
- {
- struct FormatContext Context;
-
- Context.Index = Buffer;
- Context.Size = MaxLen;
- Context.Overflow = FALSE;
-
- RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
-
- if(NO Context.Overflow)
- result = SUCCESS;
- }
-
- return(result);
-}
-
-BOOL
-SPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- ...)
-{
- va_list VarArgs;
- BOOL result = FAILURE;
-
- /* format a text, varargs version */
-
- if (Buffer == NULL && FormatString == NULL) return result;
-
- va_start(VarArgs,FormatString);
- result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
- va_end(VarArgs);
-
- return(result);
-}
-
-char *ASPrintf(const char *fmt, ...)
-{
- int r;
- va_list ap;
- static char buffer[2048];
- char *rbuf;
-
- va_start(ap, fmt);
- r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
- va_end(ap);
-
- r = strlen(buffer);
- rbuf = AllocVec(r+1, MEMF_CLEAR);
- if (rbuf != NULL)
- {
- strncpy(rbuf, buffer, r);
- }
- return rbuf;
-}
-
-/* C */
-char *strlwr(char *str)
-{
- size_t i;
- size_t len = strlen(str);
-
- for(i=0; i<len; i++)
- str[i] = tolower((unsigned char)str[i]);
-
- return str;
-}
-
-char *strsep(char **s1, const char *s2)
-{
- char *const p1 = *s1;
-
- if (p1 != NULL) {
- *s1 = strpbrk(p1, s2);
- if (*s1 != NULL) {
- *(*s1)++ = '\0';
- }
- }
- return p1;
-}
-
-int scandir(const char *dir, struct dirent ***namelist,
- int (*filter)(const struct dirent *),
- int (*compar)(const struct dirent **, const struct dirent **))
-{
- /*\todo stub function, needs writing, preferably into clib2 */
- return 0;
-}
-
-long long int strtoll(const char *nptr, char **endptr, int base)
-{
- return (long long int)strtol(nptr, endptr, base);
-}
-
#endif
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 073a95f..8d7ddcd 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -146,14 +146,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->height = height;
gg->layerinfo = NewLayerInfo();
- gg->areabuf = AllocVecTagList(AREA_SIZE, NULL);
+ gg->areabuf = malloc(AREA_SIZE);
-#ifdef __amigaos4__
- gg->tmprasbuf = AllocVecTagList(width * height, NULL);
-#else
/* OS3/AGA requires this to be in chip mem. RTG would probably rather it wasn't. */
- gg->tmprasbuf = AllocVec(width * height, MEMF_CHIP);
-#endif
+ gg->tmprasbuf = ami_memory_chip_alloc(width * height);
if(gg->palette_mapped == true) {
gg->bm = AllocBitMap(width, height, depth, 0, friend);
@@ -172,7 +168,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
if(!gg->bm) amiga_warn_user("NoMemory","");
- gg->rp = AllocVecTagList(sizeof(struct RastPort), NULL);
+ gg->rp = malloc(sizeof(struct RastPort));
if(!gg->rp) amiga_warn_user("NoMemory","");
InitRastPort(gg->rp);
@@ -185,12 +181,12 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
InstallLayerHook(gg->rp->Layer,LAYERS_NOBACKFILL);
- gg->rp->AreaInfo = AllocVecTagList(sizeof(struct AreaInfo), NULL);
+ gg->rp->AreaInfo = malloc(sizeof(struct AreaInfo));
if((!gg->areabuf) || (!gg->rp->AreaInfo)) amiga_warn_user("NoMemory","");
- InitArea(gg->rp->AreaInfo,gg->areabuf, AREA_SIZE/5);
+ InitArea(gg->rp->AreaInfo, gg->areabuf, AREA_SIZE/5);
- gg->rp->TmpRas = AllocVecTagList(sizeof(struct TmpRas), NULL);
+ gg->rp->TmpRas = malloc(sizeof(struct TmpRas));
if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) amiga_warn_user("NoMemory","");
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
@@ -219,13 +215,13 @@ void ami_free_layers(struct gui_globals *gg)
if(gg->rp) {
DeleteLayer(0,gg->rp->Layer);
- FreeVec(gg->rp->TmpRas);
- FreeVec(gg->rp->AreaInfo);
- FreeVec(gg->rp);
+ free(gg->rp->TmpRas);
+ free(gg->rp->AreaInfo);
+ free(gg->rp);
}
- FreeVec(gg->tmprasbuf);
- FreeVec(gg->areabuf);
+ ami_memory_chip_free(gg->tmprasbuf);
+ free(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
if(gg->palette_mapped == false) {
if(gg->bm) ami_rtg_freebitmap(gg->bm);
@@ -713,7 +709,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
bfbm.offsetx = ox;
bfbm.offsety = oy;
bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
- bfh = ami_misc_allocvec_clear(sizeof(struct Hook), 0); /* NB: Was not MEMF_PRIVATE */
+ bfh = calloc(1, sizeof(struct Hook));
bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
bfh->h_SubEntry = 0;
bfh->h_Data = &bfbm;
@@ -727,7 +723,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
else
#endif
- FreeVec(bfh);
+ free(bfh);
if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
/**\todo is this logic logical? */
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 7c0dfd9..25a4c32 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -62,7 +62,6 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/print.h"
#include "amiga/utf8.h"
@@ -134,11 +133,11 @@ static void ami_print_ui_free(void)
int i;
for(i = 0; i < PGID_LAST; i++) {
- if(gadlab[i]) FreeVec((APTR)gadlab[i]);
+ if(gadlab[i]) free((APTR)gadlab[i]);
}
for(i = 0; i < 10; i++) {
- if(printers[i]) FreeVec(printers[i]);
+ if(printers[i]) free(printers[i]);
}
}
@@ -228,21 +227,21 @@ void ami_print_ui(struct hlcache_handle *c)
char filename[30];
int i;
- struct ami_print_window *pw = ami_misc_allocvec_clear(sizeof(struct ami_print_window), 0);
+ struct ami_print_window *pw = calloc(1, sizeof(struct ami_print_window));
pw->c = c;
- printers[0] = ami_misc_allocvec_clear(50, 0);
+ printers[0] = calloc(1, 50);
ami_print_readunit("ENV:Sys/printer.prefs", printers[0], 50, 0);
strcpy(filename,"ENV:Sys/printerN.prefs");
for (i = 1; i < 10; i++)
{
filename[15] = '0' + i;
- printers[i] = AllocVecTagList(50, NULL);
+ printers[i] = malloc(50);
if(!ami_print_readunit(filename, printers[i], 50, i))
{
- FreeVec(printers[i]);
+ free(printers[i]);
printers[i] = NULL;
break;
}
@@ -483,7 +482,7 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
+ ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
if(!ami_print_info.gg) return false;
ami_init_layers(ami_print_info.gg,
@@ -510,7 +509,7 @@ bool ami_print_next_page(void)
void ami_print_end(void)
{
ami_free_layers(ami_print_info.gg);
- FreeVec(ami_print_info.gg);
+ free(ami_print_info.gg);
DisposeObject(ami_print_info.objects[OID_MAIN]);
ami_gui_set_default_gg();
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 7a49919..7725e86 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -122,7 +122,7 @@ void ami_search_open(struct gui_window *gwin)
return;
}
- fwin = ami_misc_allocvec_clear(sizeof(struct find_window), 0);
+ fwin = calloc(1, sizeof(struct find_window));
fwin->objects[OID_MAIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 5f44a9b..5e94ca2 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -363,13 +363,13 @@ void ami_init_mouse_pointers(void)
if((ptrfile = Open(ptrfname,MODE_OLDFILE)))
{
int mx,my;
- UBYTE *pprefsbuf = AllocVecTagList(1061, NULL);
- Read(ptrfile,pprefsbuf,1061);
+ UBYTE *pprefsbuf = malloc(1061);
+ Read(ptrfile, pprefsbuf, 1061);
- mouseptrbm[i]=AllocVecTagList(sizeof(struct BitMap), NULL);
- InitBitMap(mouseptrbm[i],2,32,32);
- mouseptrbm[i]->Planes[0] = AllocRaster(32,32);
- mouseptrbm[i]->Planes[1] = AllocRaster(32,32);
+ mouseptrbm[i] = malloc(sizeof(struct BitMap));
+ InitBitMap(mouseptrbm[i], 2, 32, 32);
+ mouseptrbm[i]->Planes[0] = AllocRaster(32, 32);
+ mouseptrbm[i]->Planes[1] = AllocRaster(32, 32);
mouseptr.BitMap = mouseptrbm[i];
for(my=0;my<32;my++)
@@ -393,7 +393,7 @@ void ami_init_mouse_pointers(void)
POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
TAG_DONE);
- FreeVec(pprefsbuf);
+ free(pprefsbuf);
Close(ptrfile);
}
@@ -414,7 +414,7 @@ void ami_mouse_pointers_free(void)
{
FreeRaster(mouseptrbm[i]->Planes[0],32,32);
FreeRaster(mouseptrbm[i]->Planes[1],32,32);
- FreeVec(mouseptrbm[i]);
+ free(mouseptrbm[i]);
}
}
}
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index eea64ff..9049709 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -66,7 +66,6 @@
#include "amiga/tree.h"
#include "amiga/file.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
@@ -133,8 +132,8 @@ static void ami_tree_get_window_dimensions(int *width, int *height, void *data);
void ami_tree_destroy(struct treeview_window *twin)
{
tree_delete(twin->tree);
- FreeVec(twin->shared_pens);
- FreeVec(twin);
+ free(twin->shared_pens);
+ free(twin);
}
struct tree *ami_tree_get_tree(struct treeview_window *twin)
@@ -258,7 +257,7 @@ static void ami_tree_redraw_req_dr(void *p)
atrr_data->x, atrr_data->y,
atrr_data->width, atrr_data->height, &ctx);
- FreeVec(atrr_data);
+ free(atrr_data);
ami_gui_free_space_box(bbox);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
ami_clearclipreg(glob);
@@ -342,7 +341,7 @@ static void ami_tree_redraw_req(void *p)
}
}
- FreeVec(atrr_data);
+ free(atrr_data);
ami_gui_free_space_box(bbox);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
ami_clearclipreg(glob);
@@ -351,7 +350,7 @@ static void ami_tree_redraw_req(void *p)
static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
{
- struct ami_tree_redraw_req *atrr_data = AllocVecTagList(sizeof(struct ami_tree_redraw_req), NULL);
+ struct ami_tree_redraw_req *atrr_data = malloc(sizeof(struct ami_tree_redraw_req));
atrr_data->x = x;
atrr_data->y = y;
@@ -563,7 +562,7 @@ static void ami_tree_menu(struct treeview_window *twin)
{
if(twin->menu) return;
- if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) {
+ if((twin->menu = calloc(1, sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS))) {
twin->menu[0].nm_Type = NM_TITLE;
twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree"));
twin->menu[0].nm_Label = twin->menu_name[0];
@@ -900,7 +899,7 @@ void ami_tree_close(struct treeview_window *twin)
twin->menu_name[i] = NULL;
}
- FreeVec(twin->menu);
+ free(twin->menu);
twin->menu = NULL;
ami_utf8_free(twin->wintitle);
twin->wintitle = NULL;
@@ -1456,7 +1455,7 @@ struct treeview_window *ami_tree_create(int flags,
{
struct treeview_window *twin;
- twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0);
+ twin = calloc(1, sizeof(struct treeview_window));
if(!twin)
{
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4f0c9b6c610d1eb9a5b...
commit 4f0c9b6c610d1eb9a5bcccf6dbf3f53410df9432
Merge: 2c6f2f4 faf4c1f
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Merge branch 'master' of git://git.netsurf-browser.org/netsurf into chris/malloc
Conflicts:
frontends/amiga/icon.c
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/data.c | 2 +-
frontends/amiga/bitmap.c | 9 +-
frontends/amiga/bitmap.h | 10 +-
frontends/amiga/dt_anim.c | 5 +-
frontends/amiga/gui.c | 1 +
frontends/amiga/gui.h | 5 +-
frontends/amiga/icon.c | 2 +-
frontends/amiga/iff_dr2d.c | 27 ++--
frontends/amiga/launch.c | 10 +-
frontends/amiga/login.c | 3 +-
frontends/amiga/memory.c | 11 --
frontends/amiga/memory.h | 8 +-
frontends/amiga/menu.c | 21 ++-
frontends/amiga/object.c | 6 +-
frontends/amiga/os3support.c | 317 ++++++++++++++++++++---------------------
frontends/amiga/os3support.h | 1 -
frontends/amiga/plotters.c | 31 ++--
frontends/amiga/print.c | 17 ++-
frontends/amiga/search.c | 3 +-
frontends/amiga/theme.c | 18 +--
frontends/amiga/tree.c | 17 ++-
frontends/amiga/version.c | 12 +-
frontends/beos/fetch_rsrc.cpp | 1 -
23 files changed, 260 insertions(+), 277 deletions(-)
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index d82832a..139d09a 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
+#include <nsutils/base64.h>
#include "utils/url.h"
#include "utils/nsurl.h"
@@ -32,7 +33,6 @@
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/ring.h"
-#include "nsutils/base64.h"
#include "content/fetch.h"
#include "content/fetchers.h"
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index d612abf..27ffee4 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -730,14 +730,15 @@ void ami_bitmap_set_title(struct bitmap *bm, const char *title)
bm->title = strdup(title);
}
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
{
- return bm->icondata;
+ bm->icondata = icondata;
}
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
+void ami_bitmap_free_icondata(struct bitmap *bm)
{
- bm->icondata = icondata;
+ if(bm->icondata) free(bm->icondata);
+ bm->icondata = NULL;
}
bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 771ded4..a32d740 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -63,24 +63,24 @@ void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
void ami_bitmap_set_title(struct bitmap *bm, const char *title);
/**
- * Get an icondata pointer
+ * Set an icondata pointer
*
* \param bm a bitmap, as returned by bitmap_create()
- * \return pointer to the icondata area
+ * \param icondata a pointer to memory
*
* This function probably shouldn't be here!
*/
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
/**
- * Set an icondata pointer
+ * Free an icondata pointer
*
* \param bm a bitmap, as returned by bitmap_create()
* \param icondata a pointer to memory
*
* This function probably shouldn't be here!
*/
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
+void ami_bitmap_free_icondata(struct bitmap *bm);
/**
* Test if a BitMap is owned by a bitmap.
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 3175cf1..a486334 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -46,7 +46,6 @@
#include "amiga/bitmap.h"
#include "amiga/filetype.h"
#include "amiga/datatypes.h"
-#include "amiga/memory.h"
#include "amiga/plotters.h"
typedef struct amiga_dt_anim_content {
@@ -216,7 +215,7 @@ bool amiga_dt_anim_convert(struct content *c)
#else
#warning FIXME: Need to use a different blitter function for OS3!
#endif
- FreeVec(clut);
+ free(clut);
adt_frame.MethodID = ADTM_UNLOADFRAME;
IDoMethodA(plugin->dto, (Msg)&adt_frame);
@@ -344,7 +343,7 @@ content_type amiga_dt_anim_content_type(void)
static APTR ami_colormap_to_clut(struct ColorMap *cmap)
{
int i;
- UBYTE *clut = ami_misc_allocvec_clear(256 * 4, 0); /* NB: Was not MEMF_PRIVATE */
+ UBYTE *clut = calloc(1, 256 * 4);
ULONG colr[256 * 4];
if(!clut) return NULL;
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 24eb9ac..ecc36fa 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -140,6 +140,7 @@
#include "amiga/launch.h"
#include "amiga/libs.h"
#include "amiga/login.h"
+#include "amiga/memory.h"
#include "amiga/menu.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index f0abd4c..db3fef20 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -176,9 +176,11 @@ extern struct Screen *scrn;
extern struct MsgPort *sport;
extern struct gui_window *cur_gw;
-/* The return value must be deallocated using FreeVec() */
+/* The return value for these functions must be deallocated using FreeVec() */
STRPTR ami_locale_langs(int *codeset);
+char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
+/* Functions lacking documentation */
void ami_get_msg(void);
void ami_try_quit(void);
void ami_quit_netsurf(void);
@@ -194,7 +196,6 @@ void ami_gui_tabs_toggle_all(void);
bool ami_locate_resource(char *fullpath, const char *file);
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
-char *ami_gui_get_cache_favicon_name(struct nsurl *url, bool only_if_avail);
int ami_gui_count_windows(int window, int *tabs);
void ami_gui_set_scale(struct gui_window *gw, float scale);
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index c9fc6fd..3f597a1 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -542,6 +542,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) free(ami_bitmap_get_icondata(bm));
+ if(bm) ami_bitmap_free_icondata(bm);
}
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index 1c8d7db..91973f4 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -19,6 +19,7 @@
#ifdef WITH_NS_SVG
#include <stdio.h>
+#include <stdlib.h>
#include <inttypes.h>
#include <svgtiny.h>
#include <proto/exec.h>
@@ -30,11 +31,9 @@
#include "netsurf/content.h"
#include "amiga/os3support.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/memory.h"
#else
#include "os3support.h"
#include "iff_dr2d.h"
-#include "misc.h"
#endif
static struct ColorRegister cm[1000];
@@ -171,7 +170,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
}
for (unsigned int i = 0; i != diagram->shape_count; i++) {
- attr = ami_misc_allocvec_clear(sizeof(struct attr_struct), 0);
+ attr = calloc(1, sizeof(struct attr_struct));
if (diagram->shape[i].fill == svgtiny_TRANSPARENT)
attr->FillType = FT_NONE;
else
@@ -193,7 +192,7 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
WriteChunkBytes(iffh,attr,14);
PopChunk(iffh);
}
- FreeVec(attr);
+ free(attr);
if (diagram->shape[i].path) {
union {
@@ -272,30 +271,30 @@ bool ami_svg_to_dr2d(struct IFFHandle *iffh, const char *buffer,
PopChunk(iffh);
}
} else if (diagram->shape[i].text) {
- stxt = ami_misc_allocvec_clear(sizeof(struct stxt_struct), 0);
+ stxt = calloc(1, sizeof(struct stxt_struct));
stxt->BaseX = diagram->shape[i].text_x;
stxt->BaseY = diagram->shape[i].text_y;
stxt->NumChars = strlen(diagram->shape[i].text);
if(!fons_written)
{
- fons = ami_misc_allocvec_clear(sizeof(struct fons_struct), 0);
- if(!(PushChunk(iffh,0,ID_FONS,IFFSIZE_UNKNOWN)))
+ fons = calloc(1, sizeof(struct fons_struct));
+ if(!(PushChunk(iffh, 0, ID_FONS, IFFSIZE_UNKNOWN)))
{
WriteChunkBytes(iffh, fons, sizeof(struct fons_struct));
WriteChunkBytes(iffh, "Topaz\0", 6);
PopChunk(iffh);
}
- FreeVec(fons);
+ free(fons);
fons_written = TRUE;
}
- if(!(PushChunk(iffh,0,ID_STXT,IFFSIZE_UNKNOWN)))
+ if(!(PushChunk(iffh, 0, ID_STXT, IFFSIZE_UNKNOWN)))
{
- WriteChunkBytes(iffh,stxt,26);
- WriteChunkBytes(iffh,diagram->shape[i].text,strlen(diagram->shape[i].text));
+ WriteChunkBytes(iffh, stxt, 26);
+ WriteChunkBytes(iffh, diagram->shape[i].text, strlen(diagram->shape[i].text));
PopChunk(iffh);
}
- FreeVec(stxt);
+ free(stxt);
}
}
@@ -380,7 +379,7 @@ int main(int argc, char **argv)
{
size = GetFileSize(fh);
- buffer = AllocVecTagList((uint32_t)size, NULL);
+ buffer = malloc((uint32_t)size);
Read(fh,buffer,(uint32_t)size);
Close(fh);
@@ -404,7 +403,7 @@ int main(int argc, char **argv)
ami_svg_to_dr2d(iffh,buffer,size,(char *)rarray[A_SVG]);
- FreeVec(buffer);
+ free(buffer);
if(iffh) CloseIFF(iffh);
if(iffh->iff_Stream) Close((BPTR)iffh->iff_Stream);
if(iffh) FreeIFF(iffh);
diff --git a/frontends/amiga/launch.c b/frontends/amiga/launch.c
index 8020dd6..31800ef 100755
--- a/frontends/amiga/launch.c
+++ b/frontends/amiga/launch.c
@@ -50,10 +50,10 @@ static struct ami_protocol *ami_openurl_add_protocol(const char *url)
{
nsurl *ns_url;
struct ami_protocol *ami_p =
- (struct ami_protocol *)AllocVecTagList(sizeof(struct ami_protocol), NULL);
+ (struct ami_protocol *)malloc(sizeof(struct ami_protocol));
if (nsurl_create(url, &ns_url) != NSERROR_OK) {
- FreeVec(ami_p);
+ free(ami_p);
return NULL;
}
@@ -61,7 +61,7 @@ static struct ami_protocol *ami_openurl_add_protocol(const char *url)
nsurl_unref(ns_url);
if (ami_p->protocol == NULL)
{
- FreeVec(ami_p);
+ free(ami_p);
return NULL;
}
@@ -83,11 +83,11 @@ static void ami_openurl_free_list(struct MinList *list)
Remove((struct Node *)node);
if (node->protocol) lwc_string_unref(node->protocol);
- FreeVec(node);
+ free(node);
node = NULL;
}while((node=nnode));
- FreeVec(list);
+ free(list);
}
static BOOL ami_openurl_check_list(struct MinList *list, nsurl *url)
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index e1d2891..805e25c 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,7 +46,6 @@
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/object.h"
#include "amiga/login.h"
@@ -67,7 +66,7 @@ void gui_401login_open(nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
const char *auth;
- struct gui_login_window *lw = ami_misc_allocvec_clear(sizeof(struct gui_login_window), 0);
+ struct gui_login_window *lw = calloc(1, sizeof(struct gui_login_window));
lwc_string *host = nsurl_get_component(url, NSURL_HOST);
assert(host != NULL);
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 567f4f5..7a34f7a 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -47,17 +47,6 @@ void ami_memory_clear_free(void *p)
#endif
}
-void *ami_misc_allocvec_clear(int size, UBYTE value)
-{
-#ifdef __amigaos4__
- return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
-#else
- void *mem = AllocVec(size, MEMF_ANY);
- if (mem) memset(mem, value, size);
- return mem;
-#endif
-}
-
APTR ami_misc_itempool_create(int size)
{
#ifdef __amigaos4__
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 5e62864..63452f6 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -22,16 +22,18 @@
#include <exec/types.h>
/* Alloc/free chip memory */
+#ifdef __amigaos4__
+#define ami_memory_chip_alloc(s) malloc(s)
+#define ami_memory_chip_free(p) free(p)
+#else
#define ami_memory_chip_alloc(s) AllocVec(s, MEMF_CHIP)
#define ami_memory_chip_free(p) FreeVec(p)
+#endif
/* Alloc/free a block cleared to non-zero */
void *ami_memory_clear_alloc(size_t size, UBYTE value);
void ami_memory_clear_free(void *p);
-/* Standard memory allocation - to be removed */
-void *ami_misc_allocvec_clear(int size, UBYTE value);
-
/* Itempool cross-compatibility */
APTR ami_misc_itempool_create(int size);
void ami_misc_itempool_delete(APTR pool);
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index feb5c29..dc5514b 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -68,7 +68,6 @@
#include "amiga/hotlist.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/print.h"
@@ -504,11 +503,11 @@ HOOKF(void, ami_menu_item_arexx_execute, APTR, window, struct IntuiMessage *)
ASLFR_InitialDrawer, nsoption_charp(arexx_dir),
ASLFR_InitialPattern, "#?.nsrx",
TAG_DONE)) {
- if((temp = AllocVecTagList(1024, NULL))) {
+ if((temp = malloc(1024))) {
strlcpy(temp, filereq->fr_Drawer, 1024);
AddPart(temp, filereq->fr_File, 1024);
ami_arexx_execute(temp);
- FreeVec(temp);
+ free(temp);
}
}
}
@@ -521,13 +520,13 @@ HOOKF(void, ami_menu_item_arexx_entries, APTR, window, struct IntuiMessage *)
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
if(script) {
- if((temp = AllocVecTagList(1024, NULL))) {
+ if((temp = malloc(1024))) {
BPTR lock;
if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
DevNameFromLock(lock, temp, 1024, DN_FULLPATH);
AddPart(temp, script, 1024);
ami_arexx_execute(temp);
- FreeVec(temp);
+ free(temp);
UnLock(lock);
}
}
@@ -560,7 +559,7 @@ void ami_free_menulabs(struct gui_window_2 *gwin)
gwin->menukey[i] = 0;
}
- FreeVec(gwin->menutype);
+ free(gwin->menutype);
gwin->menutype = NULL;
}
@@ -609,7 +608,7 @@ static void ami_init_menulabs(struct gui_window_2 *gwin)
{
int i;
- gwin->menutype = ami_misc_allocvec_clear(sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1), 0);
+ gwin->menutype = calloc(1, sizeof(UBYTE) * (AMI_MENU_AREXX_MAX + 1));
for(i=0;i <= AMI_MENU_AREXX_MAX;i++)
{
@@ -936,7 +935,7 @@ void ami_menu_free(struct gui_window_2 *gwin)
struct Menu *ami_menu_create(struct gui_window_2 *gwin)
{
- gwin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1), 0);
+ gwin->menu = calloc(1, sizeof(struct NewMenu) * (AMI_MENU_AREXX_MAX + 1));
ami_init_menulabs(gwin);
ami_menu_scan(ami_tree_get_tree(hotlist_window), gwin);
ami_menu_arexx_scan(gwin);
@@ -959,7 +958,7 @@ struct Menu *ami_menu_create(struct gui_window_2 *gwin)
gwin->imenu = CreateMenus(gwin->menu, TAG_DONE);
LayoutMenus(gwin->imenu, gwin->vi,
GTMN_NewLookMenus, TRUE, TAG_DONE);
- FreeVec(gwin->menu); /**\todo this should be local to this function */
+ free(gwin->menu); /**\todo this should be local to this function */
gwin->menu = NULL;
return gwin->imenu;
@@ -978,7 +977,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin)
char *menu_lab;
if((lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))) {
- if((buffer = AllocVecTagList(1024, NULL))) {
+ if((buffer = malloc(1024))) {
if((ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))) {
ctrl->eac_LastKey = 0;
@@ -1009,7 +1008,7 @@ void ami_menu_arexx_scan(struct gui_window_2 *gwin)
} while(cont);
FreeDosObject(DOS_EXALLCONTROL,ctrl);
}
- FreeVec(buffer);
+ free(buffer);
}
UnLock(lock);
}
diff --git a/frontends/amiga/object.c b/frontends/amiga/object.c
index 074ad92..c729e4a 100755
--- a/frontends/amiga/object.c
+++ b/frontends/amiga/object.c
@@ -62,7 +62,7 @@ static void ami_NewMinList(struct MinList *list)
/* Allocate and initialise a new MinList */
struct MinList *ami_AllocMinList(void)
{
- struct MinList *objlist = (struct MinList *)AllocVecTagList(sizeof(struct nsList), NULL);
+ struct MinList *objlist = (struct MinList *)malloc(sizeof(struct nsList));
if(objlist == NULL) return NULL;
ami_NewMinList(objlist);
return objlist;
@@ -98,7 +98,7 @@ static void DelObjectInternal(struct nsObject *dtzo, BOOL free_obj)
{
Remove((struct Node *)dtzo);
if(dtzo->callback != NULL) dtzo->callback(dtzo->objstruct);
- if(dtzo->objstruct && free_obj) FreeVec(dtzo->objstruct);
+ if(dtzo->objstruct && free_obj) free(dtzo->objstruct);
if(dtzo->dtz_Node.ln_Name) free(dtzo->dtz_Node.ln_Name);
ami_misc_itempool_free(pool_nsobj, dtzo, sizeof(struct nsObject));
dtzo = NULL;
@@ -131,6 +131,6 @@ void FreeObjList(struct MinList *objlist)
}
} while((node=nnode));
- FreeVec(objlist);
+ free(objlist);
}
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index bdf6333..c082602 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -46,6 +46,155 @@
#define FAILURE (FALSE)
#define NO !
+/* Utility */
+struct FormatContext
+{
+ STRPTR Index;
+ LONG Size;
+ BOOL Overflow;
+};
+
+STATIC VOID ASM
+StuffChar(
+ REG(a3, struct FormatContext * Context),
+ REG(d0, UBYTE Char))
+{
+ /* Is there still room? */
+ if(Context->Size > 0)
+ {
+ (*Context->Index) = Char;
+
+ Context->Index++;
+ Context->Size--;
+
+ /* Is there only a single character left? */
+ if(Context->Size == 1)
+ {
+ /* Provide null-termination. */
+ (*Context->Index) = '\0';
+
+ /* Don't store any further characters. */
+ Context->Size = 0;
+ }
+ }
+ else
+ {
+ Context->Overflow = TRUE;
+ }
+}
+
+BOOL
+VSPrintfN(
+ LONG MaxLen,
+ STRPTR Buffer,
+ const STRPTR FormatString,
+ const va_list VarArgs)
+{
+ BOOL result = FAILURE;
+
+ /* format a text, but place only up to MaxLen
+ * characters in the output buffer (including
+ * the terminating NUL)
+ */
+
+ if (Buffer == NULL || FormatString == NULL) return(result);
+
+ if(MaxLen > 1)
+ {
+ struct FormatContext Context;
+
+ Context.Index = Buffer;
+ Context.Size = MaxLen;
+ Context.Overflow = FALSE;
+
+ RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
+
+ if(NO Context.Overflow)
+ result = SUCCESS;
+ }
+
+ return(result);
+}
+
+BOOL
+SPrintfN(
+ LONG MaxLen,
+ STRPTR Buffer,
+ const STRPTR FormatString,
+ ...)
+{
+ va_list VarArgs;
+ BOOL result = FAILURE;
+
+ /* format a text, varargs version */
+
+ if (Buffer == NULL && FormatString == NULL) return result;
+
+ va_start(VarArgs,FormatString);
+ result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
+ va_end(VarArgs);
+
+ return(result);
+}
+
+char *ASPrintf(const char *fmt, ...)
+{
+ int r;
+ va_list ap;
+ static char buffer[2048];
+ char *rbuf;
+
+ va_start(ap, fmt);
+ r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
+ va_end(ap);
+
+ r = strlen(buffer);
+ rbuf = AllocVec(r+1, MEMF_CLEAR);
+ if (rbuf != NULL)
+ {
+ strncpy(rbuf, buffer, r);
+ }
+ return rbuf;
+}
+
+/* C */
+char *strlwr(char *str)
+{
+ size_t i;
+ size_t len = strlen(str);
+
+ for(i=0; i<len; i++)
+ str[i] = tolower((unsigned char)str[i]);
+
+ return str;
+}
+
+char *strsep(char **s1, const char *s2)
+{
+ char *const p1 = *s1;
+
+ if (p1 != NULL) {
+ *s1 = strpbrk(p1, s2);
+ if (*s1 != NULL) {
+ *(*s1)++ = '\0';
+ }
+ }
+ return p1;
+}
+
+int scandir(const char *dir, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **))
+{
+ /*\todo stub function, needs writing, preferably into clib2 */
+ return 0;
+}
+
+long long int strtoll(const char *nptr, char **endptr, int base)
+{
+ return (long long int)strtol(nptr, endptr, base);
+}
+
/* Diskfont */
struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
{
@@ -99,7 +248,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
}
size = GetFileSize(fh);
- buffer = (UBYTE *)AllocVec(size, MEMF_ANY);
+ buffer = (UBYTE *)malloc(size);
if(buffer == NULL) {
LOG("Unable to allocate memory");
Close(fh);
@@ -114,7 +263,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
struct TagItem *tag = (struct TagItem *)buffer;
if((tag->ti_Tag != OT_FileIdent) || (tag->ti_Data != (ULONG)size)) {
LOG("Invalid OTAG file");
- FreeVec(buffer);
+ free(buffer);
FreeVec(otagpath);
return NULL;
}
@@ -132,7 +281,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
fname = ASPrintf("%s.library", ti->ti_Data);
} else {
LOG("Cannot find OT_Engine tag");
- FreeVec(buffer);
+ free(buffer);
FreeVec(otagpath);
return NULL;
}
@@ -141,7 +290,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
if(BulletBase == NULL) {
LOG("Unable to open font engine %s", fname);
- FreeVec(buffer);
+ free(buffer);
FreeVec(fname);
FreeVec(otagpath);
}
@@ -155,7 +304,7 @@ struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG fl
OT_OTagList, (ULONG)buffer,
TAG_DONE);
- of = AllocVec(sizeof(struct OutlineFont), MEMF_CLEAR);
+ of = calloc(1, sizeof(struct OutlineFont));
if(of == NULL) return NULL;
of->BulletBase = BulletBase;
@@ -174,8 +323,8 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
CloseLibrary((struct Library *)BulletBase);
FreeVec(of->OTagPath);
- FreeVec(of->olf_OTagList);
- FreeVec(of);
+ free(of->olf_OTagList);
+ free(of);
}
@@ -183,13 +332,13 @@ void CloseOutlineFont(struct OutlineFont *of, struct List *list)
int64 GetFileSize(BPTR fh)
{
int32 size = 0;
- struct FileInfoBlock *fib = AllocVec(sizeof(struct FileInfoBlock), MEMF_ANY);
+ struct FileInfoBlock *fib = malloc(sizeof(struct FileInfoBlock));
if(fib == NULL) return 0;
ExamineFH(fh, fib);
size = fib->fib_Size;
- FreeVec(fib);
+ free(fib);
return (int64)size;
}
@@ -280,155 +429,5 @@ APTR NewObject(struct IClass * classPtr, CONST_STRPTR classID, ULONG tagList, ..
{
return NewObjectA(classPtr, classID, (const struct TagItem *) &tagList);
}
-
-/* Utility */
-struct FormatContext
-{
- STRPTR Index;
- LONG Size;
- BOOL Overflow;
-};
-
-STATIC VOID ASM
-StuffChar(
- REG(a3, struct FormatContext * Context),
- REG(d0, UBYTE Char))
-{
- /* Is there still room? */
- if(Context->Size > 0)
- {
- (*Context->Index) = Char;
-
- Context->Index++;
- Context->Size--;
-
- /* Is there only a single character left? */
- if(Context->Size == 1)
- {
- /* Provide null-termination. */
- (*Context->Index) = '\0';
-
- /* Don't store any further characters. */
- Context->Size = 0;
- }
- }
- else
- {
- Context->Overflow = TRUE;
- }
-}
-
-BOOL
-VSPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- const va_list VarArgs)
-{
- BOOL result = FAILURE;
-
- /* format a text, but place only up to MaxLen
- * characters in the output buffer (including
- * the terminating NUL)
- */
-
- if (Buffer == NULL || FormatString == NULL) return(result);
-
- if(MaxLen > 1)
- {
- struct FormatContext Context;
-
- Context.Index = Buffer;
- Context.Size = MaxLen;
- Context.Overflow = FALSE;
-
- RawDoFmt(FormatString,(APTR)VarArgs,(VOID (*)())StuffChar,(APTR)&Context);
-
- if(NO Context.Overflow)
- result = SUCCESS;
- }
-
- return(result);
-}
-
-BOOL
-SPrintfN(
- LONG MaxLen,
- STRPTR Buffer,
- const STRPTR FormatString,
- ...)
-{
- va_list VarArgs;
- BOOL result = FAILURE;
-
- /* format a text, varargs version */
-
- if (Buffer == NULL && FormatString == NULL) return result;
-
- va_start(VarArgs,FormatString);
- result = VSPrintfN(MaxLen,Buffer,FormatString,VarArgs);
- va_end(VarArgs);
-
- return(result);
-}
-
-char *ASPrintf(const char *fmt, ...)
-{
- int r;
- va_list ap;
- static char buffer[2048];
- char *rbuf;
-
- va_start(ap, fmt);
- r = VSPrintfN(2048, buffer, (const STRPTR)fmt, ap);
- va_end(ap);
-
- r = strlen(buffer);
- rbuf = AllocVec(r+1, MEMF_CLEAR);
- if (rbuf != NULL)
- {
- strncpy(rbuf, buffer, r);
- }
- return rbuf;
-}
-
-/* C */
-char *strlwr(char *str)
-{
- size_t i;
- size_t len = strlen(str);
-
- for(i=0; i<len; i++)
- str[i] = tolower((unsigned char)str[i]);
-
- return str;
-}
-
-char *strsep(char **s1, const char *s2)
-{
- char *const p1 = *s1;
-
- if (p1 != NULL) {
- *s1 = strpbrk(p1, s2);
- if (*s1 != NULL) {
- *(*s1)++ = '\0';
- }
- }
- return p1;
-}
-
-int scandir(const char *dir, struct dirent ***namelist,
- int (*filter)(const struct dirent *),
- int (*compar)(const struct dirent **, const struct dirent **))
-{
- /*\todo stub function, needs writing, preferably into clib2 */
- return 0;
-}
-
-long long int strtoll(const char *nptr, char **endptr, int base)
-{
- return (long long int)strtol(nptr, endptr, base);
-}
-
#endif
diff --git a/frontends/amiga/os3support.h b/frontends/amiga/os3support.h
index 94d1d58..856439b 100644
--- a/frontends/amiga/os3support.h
+++ b/frontends/amiga/os3support.h
@@ -152,7 +152,6 @@
#define DevNameFromLock(A,B,C,D) NameFromLock(A,B,C)
/* Exec */
-#define AllocVecTagList(SZ,TAG) AllocVec(SZ,MEMF_ANY) /* AllocVecTagList with no tags */
#define FindIName FindName
/* Intuition */
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 073a95f..f9fa62a 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -33,6 +33,7 @@
#include <math.h>
#include <assert.h>
+#include <stdlib.h>
#include "utils/nsoption.h"
#include "utils/utils.h"
@@ -146,14 +147,10 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->height = height;
gg->layerinfo = NewLayerInfo();
- gg->areabuf = AllocVecTagList(AREA_SIZE, NULL);
+ gg->areabuf = malloc(AREA_SIZE);
-#ifdef __amigaos4__
- gg->tmprasbuf = AllocVecTagList(width * height, NULL);
-#else
/* OS3/AGA requires this to be in chip mem. RTG would probably rather it wasn't. */
- gg->tmprasbuf = AllocVec(width * height, MEMF_CHIP);
-#endif
+ gg->tmprasbuf = ami_memory_chip_alloc(width * height);
if(gg->palette_mapped == true) {
gg->bm = AllocBitMap(width, height, depth, 0, friend);
@@ -172,7 +169,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
if(!gg->bm) amiga_warn_user("NoMemory","");
- gg->rp = AllocVecTagList(sizeof(struct RastPort), NULL);
+ gg->rp = malloc(sizeof(struct RastPort));
if(!gg->rp) amiga_warn_user("NoMemory","");
InitRastPort(gg->rp);
@@ -185,12 +182,12 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
InstallLayerHook(gg->rp->Layer,LAYERS_NOBACKFILL);
- gg->rp->AreaInfo = AllocVecTagList(sizeof(struct AreaInfo), NULL);
+ gg->rp->AreaInfo = malloc(sizeof(struct AreaInfo));
if((!gg->areabuf) || (!gg->rp->AreaInfo)) amiga_warn_user("NoMemory","");
- InitArea(gg->rp->AreaInfo,gg->areabuf, AREA_SIZE/5);
+ InitArea(gg->rp->AreaInfo, gg->areabuf, AREA_SIZE/5);
- gg->rp->TmpRas = AllocVecTagList(sizeof(struct TmpRas), NULL);
+ gg->rp->TmpRas = malloc(sizeof(struct TmpRas));
if((!gg->tmprasbuf) || (!gg->rp->TmpRas)) amiga_warn_user("NoMemory","");
InitTmpRas(gg->rp->TmpRas, gg->tmprasbuf, width*height);
@@ -219,13 +216,13 @@ void ami_free_layers(struct gui_globals *gg)
if(gg->rp) {
DeleteLayer(0,gg->rp->Layer);
- FreeVec(gg->rp->TmpRas);
- FreeVec(gg->rp->AreaInfo);
- FreeVec(gg->rp);
+ free(gg->rp->TmpRas);
+ free(gg->rp->AreaInfo);
+ free(gg->rp);
}
- FreeVec(gg->tmprasbuf);
- FreeVec(gg->areabuf);
+ ami_memory_chip_free(gg->tmprasbuf);
+ free(gg->areabuf);
DisposeLayerInfo(gg->layerinfo);
if(gg->palette_mapped == false) {
if(gg->bm) ami_rtg_freebitmap(gg->bm);
@@ -713,7 +710,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
bfbm.offsetx = ox;
bfbm.offsety = oy;
bfbm.mask = ami_bitmap_get_mask(bitmap, width, height, tbm);
- bfh = ami_misc_allocvec_clear(sizeof(struct Hook), 0); /* NB: Was not MEMF_PRIVATE */
+ bfh = calloc(1, sizeof(struct Hook));
bfh->h_Entry = (HOOKFUNC)ami_bitmap_tile_hook;
bfh->h_SubEntry = 0;
bfh->h_Data = &bfbm;
@@ -727,7 +724,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
else
#endif
- FreeVec(bfh);
+ free(bfh);
if((ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
/**\todo is this logic logical? */
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 7c0dfd9..25a4c32 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -62,7 +62,6 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/print.h"
#include "amiga/utf8.h"
@@ -134,11 +133,11 @@ static void ami_print_ui_free(void)
int i;
for(i = 0; i < PGID_LAST; i++) {
- if(gadlab[i]) FreeVec((APTR)gadlab[i]);
+ if(gadlab[i]) free((APTR)gadlab[i]);
}
for(i = 0; i < 10; i++) {
- if(printers[i]) FreeVec(printers[i]);
+ if(printers[i]) free(printers[i]);
}
}
@@ -228,21 +227,21 @@ void ami_print_ui(struct hlcache_handle *c)
char filename[30];
int i;
- struct ami_print_window *pw = ami_misc_allocvec_clear(sizeof(struct ami_print_window), 0);
+ struct ami_print_window *pw = calloc(1, sizeof(struct ami_print_window));
pw->c = c;
- printers[0] = ami_misc_allocvec_clear(50, 0);
+ printers[0] = calloc(1, 50);
ami_print_readunit("ENV:Sys/printer.prefs", printers[0], 50, 0);
strcpy(filename,"ENV:Sys/printerN.prefs");
for (i = 1; i < 10; i++)
{
filename[15] = '0' + i;
- printers[i] = AllocVecTagList(50, NULL);
+ printers[i] = malloc(50);
if(!ami_print_readunit(filename, printers[i], 50, i))
{
- FreeVec(printers[i]);
+ free(printers[i]);
printers[i] = NULL;
break;
}
@@ -483,7 +482,7 @@ struct MsgPort *ami_print_get_msgport(void)
bool ami_print_begin(struct print_settings *ps)
{
- ami_print_info.gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
+ ami_print_info.gg = calloc(1, sizeof(struct gui_globals));
if(!ami_print_info.gg) return false;
ami_init_layers(ami_print_info.gg,
@@ -510,7 +509,7 @@ bool ami_print_next_page(void)
void ami_print_end(void)
{
ami_free_layers(ami_print_info.gg);
- FreeVec(ami_print_info.gg);
+ free(ami_print_info.gg);
DisposeObject(ami_print_info.objects[OID_MAIN]);
ami_gui_set_default_gg();
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 7a49919..cd5ab5e 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -27,6 +27,7 @@
#include "utils/config.h"
#include <ctype.h>
#include <string.h>
+#include <stdlib.h>
#include <proto/intuition.h>
#include <proto/exec.h>
@@ -122,7 +123,7 @@ void ami_search_open(struct gui_window *gwin)
return;
}
- fwin = ami_misc_allocvec_clear(sizeof(struct find_window), 0);
+ fwin = calloc(1, sizeof(struct find_window));
fwin->objects[OID_MAIN] = WindowObj,
WA_ScreenTitle, ami_gui_get_screen_title(),
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 5f44a9b..496fc54 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -49,7 +49,7 @@
#include "amiga/bitmap.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
-#include "amiga/memory.h"
+#include "amiga/misc.h"
static struct BitMap *throbber = NULL;
static struct bitmap *throbber_nsbm = NULL;
@@ -363,13 +363,13 @@ void ami_init_mouse_pointers(void)
if((ptrfile = Open(ptrfname,MODE_OLDFILE)))
{
int mx,my;
- UBYTE *pprefsbuf = AllocVecTagList(1061, NULL);
- Read(ptrfile,pprefsbuf,1061);
+ UBYTE *pprefsbuf = malloc(1061);
+ Read(ptrfile, pprefsbuf, 1061);
- mouseptrbm[i]=AllocVecTagList(sizeof(struct BitMap), NULL);
- InitBitMap(mouseptrbm[i],2,32,32);
- mouseptrbm[i]->Planes[0] = AllocRaster(32,32);
- mouseptrbm[i]->Planes[1] = AllocRaster(32,32);
+ mouseptrbm[i] = malloc(sizeof(struct BitMap));
+ InitBitMap(mouseptrbm[i], 2, 32, 32);
+ mouseptrbm[i]->Planes[0] = AllocRaster(32, 32);
+ mouseptrbm[i]->Planes[1] = AllocRaster(32, 32);
mouseptr.BitMap = mouseptrbm[i];
for(my=0;my<32;my++)
@@ -393,7 +393,7 @@ void ami_init_mouse_pointers(void)
POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT,
TAG_DONE);
- FreeVec(pprefsbuf);
+ free(pprefsbuf);
Close(ptrfile);
}
@@ -414,7 +414,7 @@ void ami_mouse_pointers_free(void)
{
FreeRaster(mouseptrbm[i]->Planes[0],32,32);
FreeRaster(mouseptrbm[i]->Planes[1],32,32);
- FreeVec(mouseptrbm[i]);
+ free(mouseptrbm[i]);
}
}
}
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index eea64ff..9049709 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -66,7 +66,6 @@
#include "amiga/tree.h"
#include "amiga/file.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
@@ -133,8 +132,8 @@ static void ami_tree_get_window_dimensions(int *width, int *height, void *data);
void ami_tree_destroy(struct treeview_window *twin)
{
tree_delete(twin->tree);
- FreeVec(twin->shared_pens);
- FreeVec(twin);
+ free(twin->shared_pens);
+ free(twin);
}
struct tree *ami_tree_get_tree(struct treeview_window *twin)
@@ -258,7 +257,7 @@ static void ami_tree_redraw_req_dr(void *p)
atrr_data->x, atrr_data->y,
atrr_data->width, atrr_data->height, &ctx);
- FreeVec(atrr_data);
+ free(atrr_data);
ami_gui_free_space_box(bbox);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
ami_clearclipreg(glob);
@@ -342,7 +341,7 @@ static void ami_tree_redraw_req(void *p)
}
}
- FreeVec(atrr_data);
+ free(atrr_data);
ami_gui_free_space_box(bbox);
ami_update_pointer(twin->win, GUI_POINTER_DEFAULT);
ami_clearclipreg(glob);
@@ -351,7 +350,7 @@ static void ami_tree_redraw_req(void *p)
static void ami_tree_redraw_request(int x, int y, int width, int height, void *data)
{
- struct ami_tree_redraw_req *atrr_data = AllocVecTagList(sizeof(struct ami_tree_redraw_req), NULL);
+ struct ami_tree_redraw_req *atrr_data = malloc(sizeof(struct ami_tree_redraw_req));
atrr_data->x = x;
atrr_data->y = y;
@@ -563,7 +562,7 @@ static void ami_tree_menu(struct treeview_window *twin)
{
if(twin->menu) return;
- if((twin->menu = ami_misc_allocvec_clear(sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS, 0))) {
+ if((twin->menu = calloc(1, sizeof(struct NewMenu) * AMI_TREE_MENU_ITEMS))) {
twin->menu[0].nm_Type = NM_TITLE;
twin->menu_name[0] = ami_utf8_easy((char *)messages_get("Tree"));
twin->menu[0].nm_Label = twin->menu_name[0];
@@ -900,7 +899,7 @@ void ami_tree_close(struct treeview_window *twin)
twin->menu_name[i] = NULL;
}
- FreeVec(twin->menu);
+ free(twin->menu);
twin->menu = NULL;
ami_utf8_free(twin->wintitle);
twin->wintitle = NULL;
@@ -1456,7 +1455,7 @@ struct treeview_window *ami_tree_create(int flags,
{
struct treeview_window *twin;
- twin = ami_misc_allocvec_clear(sizeof(struct treeview_window), 0);
+ twin = calloc(1, sizeof(struct treeview_window));
if(!twin)
{
diff --git a/frontends/amiga/version.c b/frontends/amiga/version.c
index f7ecc2e..c3cd9e2 100644
--- a/frontends/amiga/version.c
+++ b/frontends/amiga/version.c
@@ -18,14 +18,14 @@
#include "testament.h"
-/* NB: AmigaOS revision numbers start at 1 (not 0) and are monotonically
- * incremental (v1.20 is higher than v1.3 and not the same as v1.2).
- * Consequently, this version pair may not match the user-facing one in
- * desktop/version.c. Release revisions are prepended with 6000 to ensure
- * they are higher than CI builds, and make this (slightly) less confusing.
+/* Release revisions are prepended with 6000 so the version numbers below
+ * are same as NetSurf numbering.
+ * CI builds use themselves as the revision.
+ * This means releases have a higher revision than CI builds, and stops
+ * problems created by "0" not being a valid AmigaOS revision number.
*/
#define NETSURF_VERSION_MAJOR "3"
-#define NETSURF_VERSION_MINOR_EXTERNAL "8"
+#define NETSURF_VERSION_MINOR_EXTERNAL "7"
#if defined(CI_BUILD)
#define NETSURF_VERSION_MINOR CI_BUILD
#else
diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp
index 4df246f..e77f4c9 100644
--- a/frontends/beos/fetch_rsrc.cpp
+++ b/frontends/beos/fetch_rsrc.cpp
@@ -42,7 +42,6 @@ extern "C" {
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/ring.h"
-#include "utils/base64.h"
#include "content/fetch.h"
#include "content/fetchers.h"
}
--
NetSurf Browser
6 years, 4 months
netsurf: branch master updated. release/3.6-10-gfaf4c1f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/faf4c1fb6012941134046...
...commit http://git.netsurf-browser.org/netsurf.git/commit/faf4c1fb6012941134046db...
...tree http://git.netsurf-browser.org/netsurf.git/tree/faf4c1fb6012941134046db14...
The branch, master has been updated
via faf4c1fb6012941134046db14370f60748184b05 (commit)
from 61a00c3832332bc27b991d3e20702a7f900e5098 (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=faf4c1fb60129411340...
commit faf4c1fb6012941134046db14370f60748184b05
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Free and clear icondata to avoid a potential double-free
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 7609d94..124c116 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -730,14 +730,15 @@ void ami_bitmap_set_title(struct bitmap *bm, const char *title)
bm->title = strdup(title);
}
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
{
- return bm->icondata;
+ bm->icondata = icondata;
}
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
+void ami_bitmap_free_icondata(struct bitmap *bm)
{
- bm->icondata = icondata;
+ if(bm->icondata) FreeVec(bm->icondata);
+ bm->icondata = NULL;
}
bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 771ded4..a32d740 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -63,24 +63,24 @@ void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
void ami_bitmap_set_title(struct bitmap *bm, const char *title);
/**
- * Get an icondata pointer
+ * Set an icondata pointer
*
* \param bm a bitmap, as returned by bitmap_create()
- * \return pointer to the icondata area
+ * \param icondata a pointer to memory
*
* This function probably shouldn't be here!
*/
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
/**
- * Set an icondata pointer
+ * Free an icondata pointer
*
* \param bm a bitmap, as returned by bitmap_create()
* \param icondata a pointer to memory
*
* This function probably shouldn't be here!
*/
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
+void ami_bitmap_free_icondata(struct bitmap *bm);
/**
* Test if a BitMap is owned by a bitmap.
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index bd79a55..fd996ef 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -543,6 +543,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) FreeVec(ami_bitmap_get_icondata(bm));
+ if(bm) ami_bitmap_free_icondata(bm);
}
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/bitmap.c | 9 +++++----
frontends/amiga/bitmap.h | 10 +++++-----
frontends/amiga/icon.c | 2 +-
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 7609d94..124c116 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -730,14 +730,15 @@ void ami_bitmap_set_title(struct bitmap *bm, const char *title)
bm->title = strdup(title);
}
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
{
- return bm->icondata;
+ bm->icondata = icondata;
}
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
+void ami_bitmap_free_icondata(struct bitmap *bm)
{
- bm->icondata = icondata;
+ if(bm->icondata) FreeVec(bm->icondata);
+ bm->icondata = NULL;
}
bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 771ded4..a32d740 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -63,24 +63,24 @@ void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
void ami_bitmap_set_title(struct bitmap *bm, const char *title);
/**
- * Get an icondata pointer
+ * Set an icondata pointer
*
* \param bm a bitmap, as returned by bitmap_create()
- * \return pointer to the icondata area
+ * \param icondata a pointer to memory
*
* This function probably shouldn't be here!
*/
-ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
/**
- * Set an icondata pointer
+ * Free an icondata pointer
*
* \param bm a bitmap, as returned by bitmap_create()
* \param icondata a pointer to memory
*
* This function probably shouldn't be here!
*/
-void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
+void ami_bitmap_free_icondata(struct bitmap *bm);
/**
* Test if a BitMap is owned by a bitmap.
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index bd79a55..fd996ef 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -543,6 +543,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) FreeVec(ami_bitmap_get_icondata(bm));
+ if(bm) ami_bitmap_free_icondata(bm);
}
--
NetSurf Browser
6 years, 4 months
netsurf: branch chris/malloc updated. release/3.6-11-g2c6f2f4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2c6f2f4ef5a50c3667630...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2c6f2f4ef5a50c36676308f...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2c6f2f4ef5a50c36676308f66...
The branch, chris/malloc has been updated
via 2c6f2f4ef5a50c36676308f6663c0d21edc6aa70 (commit)
from a8bd2af7103bca7145f8c566ec46f27e2be8d182 (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=2c6f2f4ef5a50c36676...
commit 2c6f2f4ef5a50c36676308f6663c0d21edc6aa70
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
More allocvec/malloc changes
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index df03756..24eb9ac 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -141,7 +141,6 @@
#include "amiga/libs.h"
#include "amiga/login.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/plotters.h"
@@ -1371,7 +1370,7 @@ nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox)
{
#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- *bbox = AllocVecTagList(sizeof(struct IBox), NULL);
+ *bbox = malloc(sizeof(struct IBox));
if(*bbox == NULL) return NSERROR_NOMEM;
GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox);
} else
@@ -1388,7 +1387,7 @@ void ami_gui_free_space_box(struct IBox *bbox)
{
#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- FreeVec(bbox);
+ free(bbox);
}
#endif
}
@@ -1516,7 +1515,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
{
struct IBox *bbox, *ibox;
- ibox = AllocVecTagList(sizeof(struct IBox), NULL);
+ ibox = malloc(sizeof(struct IBox));
if(ibox == NULL) return NULL;
if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
@@ -1537,7 +1536,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
(ibox->Top > (bbox->Top + bbox->Height)) ||
(ibox->Width < 0) || (ibox->Height < 0))
{
- FreeVec(ibox);
+ free(ibox);
ami_gui_free_space_box(bbox);
return NULL;
}
@@ -2585,7 +2584,7 @@ static void ami_handle_appmsg(void)
{
if((appwinargs = &appmsg->am_ArgList[i]))
{
- if((filename = AllocVecTagList(1024, NULL)))
+ if((filename = malloc(1024)))
{
if(appwinargs->wa_Lock)
{
@@ -2666,7 +2665,7 @@ static void ami_handle_appmsg(void)
}
}
}
- FreeVec(filename);
+ free(filename);
}
}
}
@@ -3819,7 +3818,7 @@ gui_window_create(struct browser_window *bw,
if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
- g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0);
+ g = calloc(1, sizeof(struct gui_window));
if(!g)
{
@@ -3893,7 +3892,7 @@ gui_window_create(struct browser_window *bw,
return g;
}
- g->shared = ami_misc_allocvec_clear(sizeof(struct gui_window_2), 0);
+ g->shared = calloc(1, sizeof(struct gui_window_2));
if(!g->shared)
{
@@ -3956,7 +3955,7 @@ gui_window_create(struct browser_window *bw,
g->shared->tabs=1;
g->shared->next_tab=1;
- g->shared->svbuffer = ami_misc_allocvec_clear(2000, 0);
+ g->shared->svbuffer = calloc(1, 2000);
g->shared->helphints[GID_BACK] =
translate_escape_chars(messages_get("HelpToolbarBack"));
@@ -4348,8 +4347,8 @@ gui_window_create(struct browser_window *bw,
if(!g->shared->win)
{
amiga_warn_user("NoMemory","");
- FreeVec(g->shared);
- FreeVec(g);
+ free(g->shared);
+ free(g);
return NULL;
}
@@ -4529,12 +4528,12 @@ static void gui_window_destroy(struct gui_window *g)
ami_utf8_free(g->tabtitle);
- FreeVec(g);
+ free(g);
return;
}
ami_plot_release_pens(g->shared->shared_pens);
- FreeVec(g->shared->shared_pens);
+ free(g->shared->shared_pens);
ami_schedule_redraw_remove(g->shared);
ami_schedule(-1, ami_gui_refresh_favicon, g->shared);
@@ -4564,7 +4563,7 @@ static void gui_window_destroy(struct gui_window *g)
free(g->shared->wintitle);
ami_utf8_free(g->shared->status);
- FreeVec(g->shared->svbuffer);
+ free(g->shared->svbuffer);
for(gid = 0; gid < GID_LAST; gid++)
free(g->shared->helphints[gid]);
@@ -4574,7 +4573,7 @@ static void gui_window_destroy(struct gui_window *g)
Remove(g->tab_node);
FreeClickTabNode(g->tab_node);
}
- FreeVec(g); // g->shared should be freed by DelObject()
+ free(g); // g->shared should be freed by DelObject()
if(IsMinListEmpty(window_list))
{
@@ -5266,7 +5265,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
if(g->shared->ptr_lock)
{
- FreeVec(g->shared->ptr_lock);
+ free(g->shared->ptr_lock);
g->shared->ptr_lock = NULL;
}
}
@@ -5612,7 +5611,7 @@ int main(int argc, char** argv)
len += strlen(users_dir);
len += 2; /* for poss path sep and NULL term */
- current_user_dir = AllocVecTagList(len, NULL);
+ current_user_dir = malloc(len);
if(current_user_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
ami_schedule_free();
@@ -5729,7 +5728,7 @@ int main(int argc, char** argv)
netsurf_exit();
ami_nsoption_free();
- FreeVec(current_user_dir);
+ free(current_user_dir);
FreeVec(current_user_faviconcache);
FreeVec(current_user);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 6d5188e..f0abd4c 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -176,11 +176,13 @@ extern struct Screen *scrn;
extern struct MsgPort *sport;
extern struct gui_window *cur_gw;
+/* The return value must be deallocated using FreeVec() */
+STRPTR ami_locale_langs(int *codeset);
+
void ami_get_msg(void);
void ami_try_quit(void);
void ami_quit_netsurf(void);
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw);
-STRPTR ami_locale_langs(int *codeset);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y);
bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y,
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index a890a91..fb5d1b1 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -73,7 +73,6 @@
#include "amiga/gui_options.h"
#include "amiga/help.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/nsoption.h"
#include "amiga/object.h"
#include "amiga/selectmenu.h"
@@ -636,7 +635,7 @@ void ami_gui_opts_open(void)
if(!gow)
{
- gow = ami_misc_allocvec_clear(sizeof(struct ami_gui_opts_window), 0);
+ gow = calloc(1, sizeof(struct ami_gui_opts_window));
if(gow == NULL) return;
ami_gui_opts_setup(gow);
@@ -2284,7 +2283,7 @@ struct List *ami_gui_opts_websearch(void)
const char *name;
int iter;
- list = AllocVecTagList(sizeof(struct List), NULL);
+ list = malloc(sizeof(struct List));
NewList(list);
if (nsoption_charp(search_engines_file) == NULL) return list;
@@ -2314,6 +2313,6 @@ void ami_gui_opts_websearch_free(struct List *websearchlist)
FreeChooserNode(node);
} while((node = nnode));
- FreeVec(websearchlist);
+ free(websearchlist);
}
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index fa5c249..5009ce8 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -51,7 +51,6 @@
#include "graphics/rpattr.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
#include "amiga/plotters.h"
@@ -117,8 +116,8 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
- gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0);
- gw->hw->gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
+ gw->hw = calloc(1, sizeof(struct history_window));
+ gw->hw->gg = calloc(1, sizeof(struct gui_globals));
ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false);
@@ -227,7 +226,7 @@ static bool ami_history_click(struct history_window *hw, uint16 code)
void ami_history_close(struct history_window *hw)
{
ami_free_layers(hw->gg);
- FreeVec(hw->gg);
+ free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
DelObject(hw->node);
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index bd79a55..c9fc6fd 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -49,7 +49,6 @@
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
#include "amiga/icon.h"
-#include "amiga/memory.h"
#define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */
#define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */
@@ -239,7 +238,7 @@ bool amiga_icon_convert(struct content *c)
if(dobj) FreeDiskObject(dobj);
if(format==IDFMT_PALETTEMAPPED)
- FreeVec(imagebufptr);
+ free(imagebufptr);
return true;
}
@@ -326,7 +325,7 @@ static ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG
if (alpha==0) alpha=0xff;
- argbicon = (ULONG *)AllocVecTagList(width*height*4, NULL);
+ argbicon = (ULONG *)malloc(width * height * 4);
if (!argbicon) return(NULL);
cmap=GetColorMap(pals1);
@@ -485,8 +484,8 @@ void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, cha
if(format == IDFMT_PALETTEMAPPED)
{
/* Free the 32-bit data we created */
- FreeVec(icondata1);
- FreeVec(icondata2);
+ free(icondata1);
+ free(icondata2);
}
}
@@ -501,7 +500,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
- icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);
if(bitmap) {
@@ -543,6 +542,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) FreeVec(ami_bitmap_get_icondata(bm));
+ if(bm) free(ami_bitmap_get_icondata(bm));
}
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/gui.c | 37 ++++++++++++++++++-------------------
frontends/amiga/gui.h | 4 +++-
frontends/amiga/gui_options.c | 7 +++----
frontends/amiga/history_local.c | 7 +++----
frontends/amiga/icon.c | 13 ++++++-------
5 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index df03756..24eb9ac 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -141,7 +141,6 @@
#include "amiga/libs.h"
#include "amiga/login.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/plotters.h"
@@ -1371,7 +1370,7 @@ nserror ami_gui_get_space_box(Object *obj, struct IBox **bbox)
{
#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- *bbox = AllocVecTagList(sizeof(struct IBox), NULL);
+ *bbox = malloc(sizeof(struct IBox));
if(*bbox == NULL) return NSERROR_NOMEM;
GetAttr(SPACE_RenderBox, obj, (ULONG *)*bbox);
} else
@@ -1388,7 +1387,7 @@ void ami_gui_free_space_box(struct IBox *bbox)
{
#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)SpaceBase, 53, 6)) {
- FreeVec(bbox);
+ free(bbox);
}
#endif
}
@@ -1516,7 +1515,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
{
struct IBox *bbox, *ibox;
- ibox = AllocVecTagList(sizeof(struct IBox), NULL);
+ ibox = malloc(sizeof(struct IBox));
if(ibox == NULL) return NULL;
if(ami_gui_get_space_box((Object *)gwin->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
@@ -1537,7 +1536,7 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
(ibox->Top > (bbox->Top + bbox->Height)) ||
(ibox->Width < 0) || (ibox->Height < 0))
{
- FreeVec(ibox);
+ free(ibox);
ami_gui_free_space_box(bbox);
return NULL;
}
@@ -2585,7 +2584,7 @@ static void ami_handle_appmsg(void)
{
if((appwinargs = &appmsg->am_ArgList[i]))
{
- if((filename = AllocVecTagList(1024, NULL)))
+ if((filename = malloc(1024)))
{
if(appwinargs->wa_Lock)
{
@@ -2666,7 +2665,7 @@ static void ami_handle_appmsg(void)
}
}
}
- FreeVec(filename);
+ free(filename);
}
}
}
@@ -3819,7 +3818,7 @@ gui_window_create(struct browser_window *bw,
if(curh > (scrn->Height - cury)) curh = scrn->Height - cury;
- g = ami_misc_allocvec_clear(sizeof(struct gui_window), 0);
+ g = calloc(1, sizeof(struct gui_window));
if(!g)
{
@@ -3893,7 +3892,7 @@ gui_window_create(struct browser_window *bw,
return g;
}
- g->shared = ami_misc_allocvec_clear(sizeof(struct gui_window_2), 0);
+ g->shared = calloc(1, sizeof(struct gui_window_2));
if(!g->shared)
{
@@ -3956,7 +3955,7 @@ gui_window_create(struct browser_window *bw,
g->shared->tabs=1;
g->shared->next_tab=1;
- g->shared->svbuffer = ami_misc_allocvec_clear(2000, 0);
+ g->shared->svbuffer = calloc(1, 2000);
g->shared->helphints[GID_BACK] =
translate_escape_chars(messages_get("HelpToolbarBack"));
@@ -4348,8 +4347,8 @@ gui_window_create(struct browser_window *bw,
if(!g->shared->win)
{
amiga_warn_user("NoMemory","");
- FreeVec(g->shared);
- FreeVec(g);
+ free(g->shared);
+ free(g);
return NULL;
}
@@ -4529,12 +4528,12 @@ static void gui_window_destroy(struct gui_window *g)
ami_utf8_free(g->tabtitle);
- FreeVec(g);
+ free(g);
return;
}
ami_plot_release_pens(g->shared->shared_pens);
- FreeVec(g->shared->shared_pens);
+ free(g->shared->shared_pens);
ami_schedule_redraw_remove(g->shared);
ami_schedule(-1, ami_gui_refresh_favicon, g->shared);
@@ -4564,7 +4563,7 @@ static void gui_window_destroy(struct gui_window *g)
free(g->shared->wintitle);
ami_utf8_free(g->shared->status);
- FreeVec(g->shared->svbuffer);
+ free(g->shared->svbuffer);
for(gid = 0; gid < GID_LAST; gid++)
free(g->shared->helphints[gid]);
@@ -4574,7 +4573,7 @@ static void gui_window_destroy(struct gui_window *g)
Remove(g->tab_node);
FreeClickTabNode(g->tab_node);
}
- FreeVec(g); // g->shared should be freed by DelObject()
+ free(g); // g->shared should be freed by DelObject()
if(IsMinListEmpty(window_list))
{
@@ -5266,7 +5265,7 @@ static bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
if(g->shared->ptr_lock)
{
- FreeVec(g->shared->ptr_lock);
+ free(g->shared->ptr_lock);
g->shared->ptr_lock = NULL;
}
}
@@ -5612,7 +5611,7 @@ int main(int argc, char** argv)
len += strlen(users_dir);
len += 2; /* for poss path sep and NULL term */
- current_user_dir = AllocVecTagList(len, NULL);
+ current_user_dir = malloc(len);
if(current_user_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
ami_schedule_free();
@@ -5729,7 +5728,7 @@ int main(int argc, char** argv)
netsurf_exit();
ami_nsoption_free();
- FreeVec(current_user_dir);
+ free(current_user_dir);
FreeVec(current_user_faviconcache);
FreeVec(current_user);
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 6d5188e..f0abd4c 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -176,11 +176,13 @@ extern struct Screen *scrn;
extern struct MsgPort *sport;
extern struct gui_window *cur_gw;
+/* The return value must be deallocated using FreeVec() */
+STRPTR ami_locale_langs(int *codeset);
+
void ami_get_msg(void);
void ami_try_quit(void);
void ami_quit_netsurf(void);
void ami_schedule_redraw(struct gui_window_2 *gwin, bool full_redraw);
-STRPTR ami_locale_langs(int *codeset);
int ami_key_to_nskey(ULONG keycode, struct InputEvent *ie);
bool ami_text_box_at_point(struct gui_window_2 *gwin, ULONG *restrict x, ULONG *restrict y);
bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *restrict x, int *restrict y,
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index a890a91..fb5d1b1 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -73,7 +73,6 @@
#include "amiga/gui_options.h"
#include "amiga/help.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/nsoption.h"
#include "amiga/object.h"
#include "amiga/selectmenu.h"
@@ -636,7 +635,7 @@ void ami_gui_opts_open(void)
if(!gow)
{
- gow = ami_misc_allocvec_clear(sizeof(struct ami_gui_opts_window), 0);
+ gow = calloc(1, sizeof(struct ami_gui_opts_window));
if(gow == NULL) return;
ami_gui_opts_setup(gow);
@@ -2284,7 +2283,7 @@ struct List *ami_gui_opts_websearch(void)
const char *name;
int iter;
- list = AllocVecTagList(sizeof(struct List), NULL);
+ list = malloc(sizeof(struct List));
NewList(list);
if (nsoption_charp(search_engines_file) == NULL) return list;
@@ -2314,6 +2313,6 @@ void ami_gui_opts_websearch_free(struct List *websearchlist)
FreeChooserNode(node);
} while((node = nnode));
- FreeVec(websearchlist);
+ free(websearchlist);
}
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index fa5c249..5009ce8 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -51,7 +51,6 @@
#include "graphics/rpattr.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
#include "amiga/plotters.h"
@@ -117,8 +116,8 @@ void ami_history_open(struct gui_window *gw)
if(!gw->hw)
{
- gw->hw = ami_misc_allocvec_clear(sizeof(struct history_window), 0);
- gw->hw->gg = ami_misc_allocvec_clear(sizeof(struct gui_globals), 0);
+ gw->hw = calloc(1, sizeof(struct history_window));
+ gw->hw->gg = calloc(1, sizeof(struct gui_globals));
ami_init_layers(gw->hw->gg, scrn->Width, scrn->Height, false);
@@ -227,7 +226,7 @@ static bool ami_history_click(struct history_window *hw, uint16 code)
void ami_history_close(struct history_window *hw)
{
ami_free_layers(hw->gg);
- FreeVec(hw->gg);
+ free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
DelObject(hw->node);
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index bd79a55..c9fc6fd 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -49,7 +49,6 @@
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
#include "amiga/icon.h"
-#include "amiga/memory.h"
#define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */
#define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */
@@ -239,7 +238,7 @@ bool amiga_icon_convert(struct content *c)
if(dobj) FreeDiskObject(dobj);
if(format==IDFMT_PALETTEMAPPED)
- FreeVec(imagebufptr);
+ free(imagebufptr);
return true;
}
@@ -326,7 +325,7 @@ static ULONG *amiga_icon_convertcolouricon32(UBYTE *icondata, ULONG width, ULONG
if (alpha==0) alpha=0xff;
- argbicon = (ULONG *)AllocVecTagList(width*height*4, NULL);
+ argbicon = (ULONG *)malloc(width * height * 4);
if (!argbicon) return(NULL);
cmap=GetColorMap(pals1);
@@ -485,8 +484,8 @@ void amiga_icon_superimpose_favicon(char *path, struct hlcache_handle *icon, cha
if(format == IDFMT_PALETTEMAPPED)
{
/* Free the 32-bit data we created */
- FreeVec(icondata1);
- FreeVec(icondata2);
+ free(icondata1);
+ free(icondata2);
}
}
@@ -501,7 +500,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
- icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ icondata = malloc(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT);
ami_bitmap_set_icondata(bm, icondata);
if(bitmap) {
@@ -543,6 +542,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) FreeVec(ami_bitmap_get_icondata(bm));
+ if(bm) free(ami_bitmap_get_icondata(bm));
}
--
NetSurf Browser
6 years, 4 months
netsurf: branch chris/malloc updated. release/3.6-10-ga8bd2af
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a8bd2af7103bca7145f8c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a8bd2af7103bca7145f8c56...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a8bd2af7103bca7145f8c566e...
The branch, chris/malloc has been updated
via a8bd2af7103bca7145f8c566ec46f27e2be8d182 (commit)
from 81a7e0cbe9851c2388e53950a6db3e75b1156ead (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=a8bd2af7103bca7145f...
commit a8bd2af7103bca7145f8c566ec46f27e2be8d182
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
More allocvec/malloc replacements
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 73f471f..9489110 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -127,10 +127,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
default:
if(ci_new) {
- ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem), 0);
+ ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_next->ci_Next;
} else {
- ci_new = calloc(1, sizeof(struct CollectionItem), 0);
+ ci_new = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_new;
}
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 3d9528c..3eba893 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -100,7 +100,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
APTR va[3];
- dw = calloc(1, sizeof(struct gui_download_window), 0);
+ dw = calloc(1, sizeof(struct gui_download_window));
if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
{
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index db0e716..04f8e8a 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -40,7 +40,6 @@
#include "amiga/filetype.h"
#include "amiga/icon.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/save_pdf.h"
#include "amiga/theme.h"
@@ -90,7 +89,7 @@ void ami_file_open(struct gui_window_2 *gwin)
ASLFR_FilterFunc, &aslhookfunc,
TAG_DONE))
{
- if((temp = AllocVecTagList(1024, NULL)))
+ if((temp = malloc(1024)))
{
strlcpy(temp, filereq->fr_Drawer, 1024);
AddPart(temp, filereq->fr_File, 1024);
@@ -108,7 +107,7 @@ void ami_file_open(struct gui_window_2 *gwin)
nsurl_unref(url);
}
- FreeVec(temp);
+ free(temp);
}
}
}
@@ -213,7 +212,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
void ami_file_save_req(int type, struct gui_window_2 *gwin,
struct hlcache_handle *object)
{
- char *fname = AllocVecTagList(1024, NULL);
+ char *fname = malloc(1024);
char *initial_fname = NULL;
char *fname_with_ext = NULL;
bool strip_ext = true;
@@ -224,7 +223,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
}
if(initial_fname != NULL) {
- fname_with_ext = AllocVecTagList(strlen(initial_fname) + 5, NULL); /* 5 = .ext\0 */
+ fname_with_ext = malloc(strlen(initial_fname) + 5); /* 5 = .ext\0 */
strcpy(fname_with_ext, initial_fname);
@@ -261,8 +260,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
ami_file_save(type, fname, gwin->win, object, gwin->gw->favicon, gwin->gw->bw);
}
- if(fname) FreeVec(fname);
- if(fname_with_ext) FreeVec(fname_with_ext);
+ if(fname) free(fname);
+ if(fname_with_ext) free(fname_with_ext);
}
void ami_file_req_init(void)
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index 8c658ee..a0449d8 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -31,7 +31,6 @@
#include "utils/utils.h"
#include "amiga/filetype.h"
-#include "amiga/memory.h"
#include "amiga/object.h"
/**
@@ -217,7 +216,7 @@ nserror ami_mime_init(const char *mimefile)
{
if ((node = AddObject(ami_mime_list, AMINS_MIME))) {
ObjectCallback(node, ami_mime_entry_free);
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
+ mimeentry = calloc(1, sizeof(struct ami_mime_entry));
node->objstruct = mimeentry;
if(rarray[AMI_MIME_MIMETYPE])
@@ -361,7 +360,7 @@ static APTR ami_mime_guess_add_datatype(struct DataType *dt, lwc_string **lwc_mi
node = AddObject(ami_mime_list, AMINS_MIME);
if(node == NULL) return NULL;
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
+ mimeentry = calloc(1, sizeof(struct ami_mime_entry));
if(mimeentry == NULL) return NULL;
node->objstruct = mimeentry;
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index bb0adb5..fd41c29 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -363,7 +363,7 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical
{
LOG("Requested font not found: %s", font);
if(critical == true) amiga_warn_user("CompError", font);
- FreeVec(nodedata);
+ free(nodedata);
return NULL;
}
@@ -601,7 +601,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
TAG_DONE);
#else
/* On OS3 the glyph needs to be in chip RAM */
- void *chip_glyph = AllocVec(glyph->glm_BMModulo * glyph->glm_BMRows, MEMF_CHIP);
+ void *chip_glyph = ami_memory_chip_alloc(glyph->glm_BMModulo * glyph->glm_BMRows);
if(chip_glyph != NULL) {
CopyMem(glyphbm, chip_glyph, glyph->glm_BMModulo * glyph->glm_BMRows);
@@ -612,7 +612,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
y - glyph->glm_Y0 + glyph->glm_BlackTop,
glyph->glm_BlackWidth, glyph->glm_BlackHeight);
- FreeVec(chip_glyph);
+ ami_memory_chip_free(chip_glyph);
}
#endif
}
diff --git a/frontends/amiga/font_cache.c b/frontends/amiga/font_cache.c
index 08c2fe1..3d83309 100644
--- a/frontends/amiga/font_cache.c
+++ b/frontends/amiga/font_cache.c
@@ -158,7 +158,7 @@ struct ami_font_cache_node *ami_font_cache_alloc_entry(const char *font)
uint32 hash = XXH32(font, strlen(font), 0);
nodedata = (struct ami_font_cache_node *)InsertSkipNode(ami_font_cache_list, (APTR)hash, sizeof(struct ami_font_cache_node));
#else
- nodedata = AllocVecTagList(sizeof(struct ami_font_cache_node), NULL);
+ nodedata = malloc(sizeof(struct ami_font_cache_node));
#endif
GetSysTime(&nodedata->lastused);
diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c
index c1c1732..932179e 100644
--- a/frontends/amiga/font_scan.c
+++ b/frontends/amiga/font_scan.c
@@ -99,7 +99,7 @@ const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray)
static struct ami_font_scan_window *ami_font_scan_gui_open(int32 fonts)
{
struct ami_font_scan_window *fsw =
- AllocVecTagList(sizeof(struct ami_font_scan_window), NULL);
+ malloc(sizeof(struct ami_font_scan_window));
if(fsw == NULL) return NULL;
@@ -201,7 +201,7 @@ static void ami_font_scan_gui_close(struct ami_font_scan_window *fsw)
if(fsw) {
DisposeObject(fsw->objects[FS_OID_MAIN]);
ami_utf8_free(fsw->title);
- FreeVec(fsw);
+ free(fsw);
}
}
@@ -317,10 +317,10 @@ static ULONG ami_font_scan_list(struct MinList *list)
struct nsObject *node;
do {
- if((afh = (struct AvailFontsHeader *)AllocVecTagList(afSize, NULL))) {
+ if((afh = (struct AvailFontsHeader *)malloc(afSize))) {
if(((afShortage = AvailFonts((STRPTR)afh, afSize,
AFF_DISK | AFF_OTAG | AFF_SCALED)))) {
- FreeVec(afh);
+ free(afh);
afSize += afShortage;
}
} else {
@@ -350,7 +350,7 @@ static ULONG ami_font_scan_list(struct MinList *list)
}
}
}
- FreeVec(afh);
+ free(afh);
} else {
return 0;
}
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index e74f795..5e62864 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -21,6 +21,10 @@
#include <exec/types.h>
+/* Alloc/free chip memory */
+#define ami_memory_chip_alloc(s) AllocVec(s, MEMF_CHIP)
+#define ami_memory_chip_free(p) FreeVec(p)
+
/* Alloc/free a block cleared to non-zero */
void *ami_memory_clear_alloc(size_t size, UBYTE value);
void ami_memory_clear_free(void *p);
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/clipboard.c | 4 ++--
frontends/amiga/download.c | 2 +-
frontends/amiga/file.c | 13 ++++++-------
frontends/amiga/filetype.c | 5 ++---
frontends/amiga/font_bullet.c | 6 +++---
frontends/amiga/font_cache.c | 2 +-
frontends/amiga/font_scan.c | 10 +++++-----
frontends/amiga/memory.h | 4 ++++
8 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 73f471f..9489110 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -127,10 +127,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
default:
if(ci_new) {
- ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem), 0);
+ ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_next->ci_Next;
} else {
- ci_new = calloc(1, sizeof(struct CollectionItem), 0);
+ ci_new = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_new;
}
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 3d9528c..3eba893 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -100,7 +100,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
APTR va[3];
- dw = calloc(1, sizeof(struct gui_download_window), 0);
+ dw = calloc(1, sizeof(struct gui_download_window));
if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
{
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index db0e716..04f8e8a 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -40,7 +40,6 @@
#include "amiga/filetype.h"
#include "amiga/icon.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/save_pdf.h"
#include "amiga/theme.h"
@@ -90,7 +89,7 @@ void ami_file_open(struct gui_window_2 *gwin)
ASLFR_FilterFunc, &aslhookfunc,
TAG_DONE))
{
- if((temp = AllocVecTagList(1024, NULL)))
+ if((temp = malloc(1024)))
{
strlcpy(temp, filereq->fr_Drawer, 1024);
AddPart(temp, filereq->fr_File, 1024);
@@ -108,7 +107,7 @@ void ami_file_open(struct gui_window_2 *gwin)
nsurl_unref(url);
}
- FreeVec(temp);
+ free(temp);
}
}
}
@@ -213,7 +212,7 @@ void ami_file_save(int type, char *fname, struct Window *win,
void ami_file_save_req(int type, struct gui_window_2 *gwin,
struct hlcache_handle *object)
{
- char *fname = AllocVecTagList(1024, NULL);
+ char *fname = malloc(1024);
char *initial_fname = NULL;
char *fname_with_ext = NULL;
bool strip_ext = true;
@@ -224,7 +223,7 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
}
if(initial_fname != NULL) {
- fname_with_ext = AllocVecTagList(strlen(initial_fname) + 5, NULL); /* 5 = .ext\0 */
+ fname_with_ext = malloc(strlen(initial_fname) + 5); /* 5 = .ext\0 */
strcpy(fname_with_ext, initial_fname);
@@ -261,8 +260,8 @@ void ami_file_save_req(int type, struct gui_window_2 *gwin,
ami_file_save(type, fname, gwin->win, object, gwin->gw->favicon, gwin->gw->bw);
}
- if(fname) FreeVec(fname);
- if(fname_with_ext) FreeVec(fname_with_ext);
+ if(fname) free(fname);
+ if(fname_with_ext) free(fname_with_ext);
}
void ami_file_req_init(void)
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index 8c658ee..a0449d8 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -31,7 +31,6 @@
#include "utils/utils.h"
#include "amiga/filetype.h"
-#include "amiga/memory.h"
#include "amiga/object.h"
/**
@@ -217,7 +216,7 @@ nserror ami_mime_init(const char *mimefile)
{
if ((node = AddObject(ami_mime_list, AMINS_MIME))) {
ObjectCallback(node, ami_mime_entry_free);
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
+ mimeentry = calloc(1, sizeof(struct ami_mime_entry));
node->objstruct = mimeentry;
if(rarray[AMI_MIME_MIMETYPE])
@@ -361,7 +360,7 @@ static APTR ami_mime_guess_add_datatype(struct DataType *dt, lwc_string **lwc_mi
node = AddObject(ami_mime_list, AMINS_MIME);
if(node == NULL) return NULL;
- mimeentry = ami_misc_allocvec_clear(sizeof(struct ami_mime_entry), 0);
+ mimeentry = calloc(1, sizeof(struct ami_mime_entry));
if(mimeentry == NULL) return NULL;
node->objstruct = mimeentry;
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index bb0adb5..fd41c29 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -363,7 +363,7 @@ static struct ami_font_cache_node *ami_font_open(const char *font, bool critical
{
LOG("Requested font not found: %s", font);
if(critical == true) amiga_warn_user("CompError", font);
- FreeVec(nodedata);
+ free(nodedata);
return NULL;
}
@@ -601,7 +601,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
TAG_DONE);
#else
/* On OS3 the glyph needs to be in chip RAM */
- void *chip_glyph = AllocVec(glyph->glm_BMModulo * glyph->glm_BMRows, MEMF_CHIP);
+ void *chip_glyph = ami_memory_chip_alloc(glyph->glm_BMModulo * glyph->glm_BMRows);
if(chip_glyph != NULL) {
CopyMem(glyphbm, chip_glyph, glyph->glm_BMModulo * glyph->glm_BMRows);
@@ -612,7 +612,7 @@ static inline int32 ami_font_plot_glyph(struct OutlineFont *ofont, struct RastPo
y - glyph->glm_Y0 + glyph->glm_BlackTop,
glyph->glm_BlackWidth, glyph->glm_BlackHeight);
- FreeVec(chip_glyph);
+ ami_memory_chip_free(chip_glyph);
}
#endif
}
diff --git a/frontends/amiga/font_cache.c b/frontends/amiga/font_cache.c
index 08c2fe1..3d83309 100644
--- a/frontends/amiga/font_cache.c
+++ b/frontends/amiga/font_cache.c
@@ -158,7 +158,7 @@ struct ami_font_cache_node *ami_font_cache_alloc_entry(const char *font)
uint32 hash = XXH32(font, strlen(font), 0);
nodedata = (struct ami_font_cache_node *)InsertSkipNode(ami_font_cache_list, (APTR)hash, sizeof(struct ami_font_cache_node));
#else
- nodedata = AllocVecTagList(sizeof(struct ami_font_cache_node), NULL);
+ nodedata = malloc(sizeof(struct ami_font_cache_node));
#endif
GetSysTime(&nodedata->lastused);
diff --git a/frontends/amiga/font_scan.c b/frontends/amiga/font_scan.c
index c1c1732..932179e 100644
--- a/frontends/amiga/font_scan.c
+++ b/frontends/amiga/font_scan.c
@@ -99,7 +99,7 @@ const char *ami_font_scan_lookup(const uint16 *code, lwc_string **glypharray)
static struct ami_font_scan_window *ami_font_scan_gui_open(int32 fonts)
{
struct ami_font_scan_window *fsw =
- AllocVecTagList(sizeof(struct ami_font_scan_window), NULL);
+ malloc(sizeof(struct ami_font_scan_window));
if(fsw == NULL) return NULL;
@@ -201,7 +201,7 @@ static void ami_font_scan_gui_close(struct ami_font_scan_window *fsw)
if(fsw) {
DisposeObject(fsw->objects[FS_OID_MAIN]);
ami_utf8_free(fsw->title);
- FreeVec(fsw);
+ free(fsw);
}
}
@@ -317,10 +317,10 @@ static ULONG ami_font_scan_list(struct MinList *list)
struct nsObject *node;
do {
- if((afh = (struct AvailFontsHeader *)AllocVecTagList(afSize, NULL))) {
+ if((afh = (struct AvailFontsHeader *)malloc(afSize))) {
if(((afShortage = AvailFonts((STRPTR)afh, afSize,
AFF_DISK | AFF_OTAG | AFF_SCALED)))) {
- FreeVec(afh);
+ free(afh);
afSize += afShortage;
}
} else {
@@ -350,7 +350,7 @@ static ULONG ami_font_scan_list(struct MinList *list)
}
}
}
- FreeVec(afh);
+ free(afh);
} else {
return 0;
}
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index e74f795..5e62864 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -21,6 +21,10 @@
#include <exec/types.h>
+/* Alloc/free chip memory */
+#define ami_memory_chip_alloc(s) AllocVec(s, MEMF_CHIP)
+#define ami_memory_chip_free(p) FreeVec(p)
+
/* Alloc/free a block cleared to non-zero */
void *ami_memory_clear_alloc(size_t size, UBYTE value);
void ami_memory_clear_free(void *p);
--
NetSurf Browser
6 years, 4 months
libdom: branch master updated. release/0.3.1-3-ge59d742
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libdom.git/shortlog/e59d7422cc1ce3f4446bb5...
...commit http://git.netsurf-browser.org/libdom.git/commit/e59d7422cc1ce3f4446bb520...
...tree http://git.netsurf-browser.org/libdom.git/tree/e59d7422cc1ce3f4446bb52099...
The branch, master has been updated
via e59d7422cc1ce3f4446bb520995017f1ebad19e4 (commit)
from 46d9b9509a2a5f8863189d880a6722bc3ec74344 (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/libdom.git/commit/?id=e59d7422cc1ce3f4446b...
commit e59d7422cc1ce3f4446bb520995017f1ebad19e4
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Add getter/setter for event_target's is_trusted
diff --git a/include/dom/events/event.h b/include/dom/events/event.h
index 5bb0814..aba9655 100644
--- a/include/dom/events/event.h
+++ b/include/dom/events/event.h
@@ -105,4 +105,12 @@ dom_exception _dom_event_is_initialised(dom_event *evt, bool *result);
#define dom_event_is_initialised(e,r) _dom_event_is_initialised( \
(dom_event *) (e), (bool *) (r))
+dom_exception _dom_event_get_is_trusted(dom_event *evt, bool *result);
+#define dom_event_get_is_trusted(e,r) _dom_event_get_is_trusted( \
+ (dom_event *) (e), (bool *) (r))
+
+dom_exception _dom_event_set_is_trusted(dom_event *evt, bool trusted);
+#define dom_event_set_is_trusted(e,t) _dom_event_set_is_trusted( \
+ (dom_event *) (e), (bool) (t))
+
#endif
diff --git a/src/events/event.c b/src/events/event.c
index 8a73a0d..028c2e1 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -57,6 +57,7 @@ dom_exception _dom_event_initialise(dom_event *evt)
evt->refcnt = 1;
evt->in_dispatch = false;
evt->is_initialised = false;
+ evt->is_trusted = false;
return DOM_NO_ERR;
}
@@ -367,3 +368,31 @@ dom_exception _dom_event_is_initialised(dom_event *evt, bool *result)
return DOM_NO_ERR;
}
+
+/**
+ * Return whether or not the event is currently trusted.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_get_is_trusted(dom_event *evt, bool *result)
+{
+ *result = evt->is_trusted;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Set whether or not the event is currently trusted.
+ *
+ * \param evt The event object
+ * \param trusted Whether or not the event is to be trusted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_set_is_trusted(dom_event *evt, bool trusted)
+{
+ evt->is_trusted = trusted;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/events/event.h b/src/events/event.h
index 8d8cc0f..857f20a 100644
--- a/src/events/event.h
+++ b/src/events/event.h
@@ -49,6 +49,7 @@ struct dom_event {
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
bool is_initialised; /**< Whether this event is initialised */
+ bool is_trusted; /**< Whether this event is trusted */
};
/* Destructor */
-----------------------------------------------------------------------
Summary of changes:
include/dom/events/event.h | 8 ++++++++
src/events/event.c | 29 +++++++++++++++++++++++++++++
src/events/event.h | 1 +
3 files changed, 38 insertions(+)
diff --git a/include/dom/events/event.h b/include/dom/events/event.h
index 5bb0814..aba9655 100644
--- a/include/dom/events/event.h
+++ b/include/dom/events/event.h
@@ -105,4 +105,12 @@ dom_exception _dom_event_is_initialised(dom_event *evt, bool *result);
#define dom_event_is_initialised(e,r) _dom_event_is_initialised( \
(dom_event *) (e), (bool *) (r))
+dom_exception _dom_event_get_is_trusted(dom_event *evt, bool *result);
+#define dom_event_get_is_trusted(e,r) _dom_event_get_is_trusted( \
+ (dom_event *) (e), (bool *) (r))
+
+dom_exception _dom_event_set_is_trusted(dom_event *evt, bool trusted);
+#define dom_event_set_is_trusted(e,t) _dom_event_set_is_trusted( \
+ (dom_event *) (e), (bool) (t))
+
#endif
diff --git a/src/events/event.c b/src/events/event.c
index 8a73a0d..028c2e1 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -57,6 +57,7 @@ dom_exception _dom_event_initialise(dom_event *evt)
evt->refcnt = 1;
evt->in_dispatch = false;
evt->is_initialised = false;
+ evt->is_trusted = false;
return DOM_NO_ERR;
}
@@ -367,3 +368,31 @@ dom_exception _dom_event_is_initialised(dom_event *evt, bool *result)
return DOM_NO_ERR;
}
+
+/**
+ * Return whether or not the event is currently trusted.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_get_is_trusted(dom_event *evt, bool *result)
+{
+ *result = evt->is_trusted;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Set whether or not the event is currently trusted.
+ *
+ * \param evt The event object
+ * \param trusted Whether or not the event is to be trusted
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_set_is_trusted(dom_event *evt, bool trusted)
+{
+ evt->is_trusted = trusted;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/events/event.h b/src/events/event.h
index 8d8cc0f..857f20a 100644
--- a/src/events/event.h
+++ b/src/events/event.h
@@ -49,6 +49,7 @@ struct dom_event {
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
bool is_initialised; /**< Whether this event is initialised */
+ bool is_trusted; /**< Whether this event is trusted */
};
/* Destructor */
--
Document Object Model library
6 years, 4 months
libdom: branch master updated. release/0.3.1-2-g46d9b95
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libdom.git/shortlog/46d9b9509a2a5f8863189d...
...commit http://git.netsurf-browser.org/libdom.git/commit/46d9b9509a2a5f8863189d88...
...tree http://git.netsurf-browser.org/libdom.git/tree/46d9b9509a2a5f8863189d880a...
The branch, master has been updated
via 46d9b9509a2a5f8863189d880a6722bc3ec74344 (commit)
via c367d92d41291e2fb88bac81159bf2a2cdc096fe (commit)
from 56bc77504bd6e45b52cedd5a293d57c076ad9c98 (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/libdom.git/commit/?id=46d9b9509a2a5f886318...
commit 46d9b9509a2a5f8863189d880a6722bc3ec74344
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Add an is_initialised flag to events
diff --git a/src/events/event.c b/src/events/event.c
index 62a5739..8a73a0d 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -56,6 +56,7 @@ dom_exception _dom_event_initialise(dom_event *evt)
evt->refcnt = 1;
evt->in_dispatch = false;
+ evt->is_initialised = false;
return DOM_NO_ERR;
}
@@ -252,6 +253,7 @@ dom_exception _dom_event_init(dom_event *evt, dom_string *type,
evt->type = dom_string_ref(type);
evt->bubble = bubble;
evt->cancelable = cancelable;
+ evt->is_initialised = true;
evt->timestamp = time(NULL);
@@ -333,6 +335,7 @@ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
evt->bubble = bubble;
evt->cancelable = cancelable;
+ evt->is_initialised = true;
return DOM_NO_ERR;
}
@@ -350,3 +353,17 @@ dom_exception _dom_event_in_dispatch(dom_event *evt, bool *result)
return DOM_NO_ERR;
}
+
+/**
+ * Return whether or not the event is currently initialised.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_is_initialised(dom_event *evt, bool *result)
+{
+ *result = evt->is_initialised;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/events/event.h b/src/events/event.h
index 4835bd0..8d8cc0f 100644
--- a/src/events/event.h
+++ b/src/events/event.h
@@ -48,6 +48,7 @@ struct dom_event {
struct dom_event_private_vtable *vtable;
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
+ bool is_initialised; /**< Whether this event is initialised */
};
/* Destructor */
commitdiff http://git.netsurf-browser.org/libdom.git/commit/?id=c367d92d41291e2fb88b...
commit c367d92d41291e2fb88bac81159bf2a2cdc096fe
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Add support to retrieve if an event is in dispatch
diff --git a/include/dom/events/event.h b/include/dom/events/event.h
index 93c2955..5bb0814 100644
--- a/include/dom/events/event.h
+++ b/include/dom/events/event.h
@@ -97,4 +97,12 @@ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
(dom_event *) (e), (dom_string *) (n), \
(dom_string *) (t), (bool) (b), (bool) (c))
+dom_exception _dom_event_in_dispatch(dom_event *evt, bool *result);
+#define dom_event_in_dispatch(e,r) _dom_event_in_dispatch( \
+ (dom_event *) (e), (bool *) (r))
+
+dom_exception _dom_event_is_initialised(dom_event *evt, bool *result);
+#define dom_event_is_initialised(e,r) _dom_event_is_initialised( \
+ (dom_event *) (e), (bool *) (r))
+
#endif
diff --git a/src/events/event.c b/src/events/event.c
index 821c5e7..62a5739 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -337,3 +337,16 @@ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
return DOM_NO_ERR;
}
+/**
+ * Return whether or not the event is in dispatch currently.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_in_dispatch(dom_event *evt, bool *result)
+{
+ *result = evt->in_dispatch;
+
+ return DOM_NO_ERR;
+}
-----------------------------------------------------------------------
Summary of changes:
include/dom/events/event.h | 8 ++++++++
src/events/event.c | 30 ++++++++++++++++++++++++++++++
src/events/event.h | 1 +
3 files changed, 39 insertions(+)
diff --git a/include/dom/events/event.h b/include/dom/events/event.h
index 93c2955..5bb0814 100644
--- a/include/dom/events/event.h
+++ b/include/dom/events/event.h
@@ -97,4 +97,12 @@ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
(dom_event *) (e), (dom_string *) (n), \
(dom_string *) (t), (bool) (b), (bool) (c))
+dom_exception _dom_event_in_dispatch(dom_event *evt, bool *result);
+#define dom_event_in_dispatch(e,r) _dom_event_in_dispatch( \
+ (dom_event *) (e), (bool *) (r))
+
+dom_exception _dom_event_is_initialised(dom_event *evt, bool *result);
+#define dom_event_is_initialised(e,r) _dom_event_is_initialised( \
+ (dom_event *) (e), (bool *) (r))
+
#endif
diff --git a/src/events/event.c b/src/events/event.c
index 821c5e7..8a73a0d 100644
--- a/src/events/event.c
+++ b/src/events/event.c
@@ -56,6 +56,7 @@ dom_exception _dom_event_initialise(dom_event *evt)
evt->refcnt = 1;
evt->in_dispatch = false;
+ evt->is_initialised = false;
return DOM_NO_ERR;
}
@@ -252,6 +253,7 @@ dom_exception _dom_event_init(dom_event *evt, dom_string *type,
evt->type = dom_string_ref(type);
evt->bubble = bubble;
evt->cancelable = cancelable;
+ evt->is_initialised = true;
evt->timestamp = time(NULL);
@@ -333,7 +335,35 @@ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
evt->bubble = bubble;
evt->cancelable = cancelable;
+ evt->is_initialised = true;
return DOM_NO_ERR;
}
+/**
+ * Return whether or not the event is in dispatch currently.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_in_dispatch(dom_event *evt, bool *result)
+{
+ *result = evt->in_dispatch;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Return whether or not the event is currently initialised.
+ *
+ * \param evt The event object
+ * \param result Pointer to result object
+ * \return DOM_NO_ERR on success, appropriate dom_exception on failure.
+ */
+dom_exception _dom_event_is_initialised(dom_event *evt, bool *result)
+{
+ *result = evt->is_initialised;
+
+ return DOM_NO_ERR;
+}
diff --git a/src/events/event.h b/src/events/event.h
index 4835bd0..8d8cc0f 100644
--- a/src/events/event.h
+++ b/src/events/event.h
@@ -48,6 +48,7 @@ struct dom_event {
struct dom_event_private_vtable *vtable;
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
+ bool is_initialised; /**< Whether this event is initialised */
};
/* Destructor */
--
Document Object Model library
6 years, 4 months
netsurf: branch master updated. release/3.6-9-g61a00c3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/61a00c3832332bc27b991...
...commit http://git.netsurf-browser.org/netsurf.git/commit/61a00c3832332bc27b991d3...
...tree http://git.netsurf-browser.org/netsurf.git/tree/61a00c3832332bc27b991d3e2...
The branch, master has been updated
via 61a00c3832332bc27b991d3e20702a7f900e5098 (commit)
from cdde777d9cf157460201c59c5cc05c7479c3f830 (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=61a00c3832332bc27b9...
commit 61a00c3832332bc27b991d3e20702a7f900e5098
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix unecessary base64 header include
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index d82832a..139d09a 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
+#include <nsutils/base64.h>
#include "utils/url.h"
#include "utils/nsurl.h"
@@ -32,7 +33,6 @@
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/ring.h"
-#include "nsutils/base64.h"
#include "content/fetch.h"
#include "content/fetchers.h"
diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp
index 4df246f..e77f4c9 100644
--- a/frontends/beos/fetch_rsrc.cpp
+++ b/frontends/beos/fetch_rsrc.cpp
@@ -42,7 +42,6 @@ extern "C" {
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/ring.h"
-#include "utils/base64.h"
#include "content/fetch.h"
#include "content/fetchers.h"
}
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/data.c | 2 +-
frontends/beos/fetch_rsrc.cpp | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index d82832a..139d09a 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <stdlib.h>
#include <libwapcaplet/libwapcaplet.h>
+#include <nsutils/base64.h>
#include "utils/url.h"
#include "utils/nsurl.h"
@@ -32,7 +33,6 @@
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/ring.h"
-#include "nsutils/base64.h"
#include "content/fetch.h"
#include "content/fetchers.h"
diff --git a/frontends/beos/fetch_rsrc.cpp b/frontends/beos/fetch_rsrc.cpp
index 4df246f..e77f4c9 100644
--- a/frontends/beos/fetch_rsrc.cpp
+++ b/frontends/beos/fetch_rsrc.cpp
@@ -42,7 +42,6 @@ extern "C" {
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/ring.h"
-#include "utils/base64.h"
#include "content/fetch.h"
#include "content/fetchers.h"
}
--
NetSurf Browser
6 years, 4 months
netsurf: branch chris/malloc created. release/3.6-9-g81a7e0c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/81a7e0cbe9851c2388e53...
...commit http://git.netsurf-browser.org/netsurf.git/commit/81a7e0cbe9851c2388e5395...
...tree http://git.netsurf-browser.org/netsurf.git/tree/81a7e0cbe9851c2388e53950a...
The branch, chris/malloc has been created
at 81a7e0cbe9851c2388e53950a6db3e75b1156ead (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=81a7e0cbe9851c2388e...
commit 81a7e0cbe9851c2388e53950a6db3e75b1156ead
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Change some AllocVecs to mallocs and FreeVecs to free
Need to be careful with ASPrintf
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index ad2d237..cdb12c2 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -42,7 +42,6 @@
#include "amiga/hotlist.h"
#include "amiga/tree.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
@@ -272,7 +271,7 @@ RXHOOKF(rx_open)
{
if(!gw) return;
- dln = ami_misc_allocvec_clear(sizeof(struct dlnode), 0);
+ dln = calloc(1, sizeof(struct dlnode));
dln->filename = strdup((char *)cmd->ac_ArgList[3]);
dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
dln->node.ln_Type = NT_USER;
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 7609d94..d612abf 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -113,7 +113,7 @@ void *amiga_bitmap_create(int width, int height, unsigned int state)
bitmap = ami_misc_itempool_alloc(pool_bitmap, sizeof(struct bitmap));
if(bitmap == NULL) return NULL;
- bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
+ bitmap->pixdata = ami_memory_clear_alloc(width*height*4, 0xff);
bitmap->width = width;
bitmap->height = height;
@@ -170,7 +170,7 @@ void amiga_bitmap_destroy(void *bitmap)
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
if(bm->drawhandle) ReleaseDrawHandle(bm->drawhandle);
- FreeVec(bm->pixdata);
+ ami_memory_clear_free(bm->pixdata);
if(bm->url) nsurl_unref(bm->url);
if(bm->title) free(bm->title);
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 4933f59..73f471f 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -45,7 +45,6 @@
#include "amiga/iff_cset.h"
#include "amiga/iff_dr2d.h"
#include "amiga/menu.h"
-#include "amiga/memory.h"
#include "amiga/utf8.h"
#define ID_UTF8 MAKE_ID('U','T','F','8')
@@ -114,10 +113,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
case 0:
if(ci_new) {
- ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_next->ci_Next;
} else {
- ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_new = calloc(1, sizeof(struct CollectionItem));
ci_next = ci_new;
}
@@ -128,10 +127,10 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
default:
if(ci_new) {
- ci_next->ci_Next = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_next->ci_Next = calloc(1, sizeof(struct CollectionItem), 0);
ci_next = ci_next->ci_Next;
} else {
- ci_new = ami_misc_allocvec_clear(sizeof(struct CollectionItem), 0);
+ ci_new = calloc(1, sizeof(struct CollectionItem), 0);
ci_next = ci_new;
}
@@ -166,7 +165,7 @@ static char *ami_clipboard_cat_collection(struct CollectionItem *ci, LONG codese
if(ci_new) {
free(ci_curr->ci_Data);
- FreeVec(ci_curr);
+ free(ci_curr);
}
} while ((ci_curr = ci_next));
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 0750e5e..3d9528c 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -64,7 +64,6 @@
#include "amiga/file.h"
#include "amiga/iff_dr2d.h"
#include "amiga/libs.h"
-#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
@@ -101,7 +100,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
APTR va[3];
- dw = ami_misc_allocvec_clear(sizeof(struct gui_download_window), 0);
+ dw = calloc(1, sizeof(struct gui_download_window), 0);
if(gui && (!IsListEmpty(&gui->dllist)) && (dw->dln = (struct dlnode *)FindName(&gui->dllist,url)))
{
@@ -123,13 +122,13 @@ static struct gui_download_window *gui_download_window_create(download_context *
AddPart((STRPTR)&dw->fname,savereq->fr_File,1024);
if(!ami_download_check_overwrite(dw->fname, gui->shared->win, total_size))
{
- FreeVec(dw);
+ free(dw);
return NULL;
}
}
else
{
- FreeVec(dw);
+ free(dw);
return NULL;
}
}
@@ -146,7 +145,7 @@ static struct gui_download_window *gui_download_window_create(download_context *
if(!(dw->fh = FOpen((STRPTR)&dw->fname,MODE_NEWFILE,0)))
{
- FreeVec(dw);
+ free(dw);
return NULL;
}
@@ -261,7 +260,7 @@ static void gui_download_window_done(struct gui_download_window *dw)
free(dln->filename);
Remove((struct Node *)dln);
- FreeVec(dln);
+ free(dln);
}
FClose(dw->fh);
@@ -344,7 +343,7 @@ void ami_free_download_list(struct List *dllist)
free(node->node.ln_Name);
free(node->filename);
Remove((struct Node *)node);
- FreeVec((struct Node *)node);
+ free((struct Node *)node);
}while((node=nnode));
}
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index 874f852..567f4f5 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -25,6 +25,28 @@
ULONG __slab_max_size = 8192; /* Enable clib2's slab allocator */
#endif
+/* Special clear (ie. non-zero), which is different on OS3 and 4 */
+void *ami_memory_clear_alloc(size_t size, UBYTE value)
+{
+#ifdef __amigaos4__
+ return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
+#else
+ void *mem = malloc(size);
+ if (mem) memset(mem, value, size);
+ return mem;
+#endif
+}
+
+/* Free special clear (ie. non-zero) area, which is different on OS3 and 4 */
+void ami_memory_clear_free(void *p)
+{
+#ifdef __amigaos4__
+ FreeVec(p);
+#else
+ free(p);
+#endif
+}
+
void *ami_misc_allocvec_clear(int size, UBYTE value)
{
#ifdef __amigaos4__
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 1c51f30..e74f795 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -21,7 +21,11 @@
#include <exec/types.h>
-/* Standard memory allocation */
+/* Alloc/free a block cleared to non-zero */
+void *ami_memory_clear_alloc(size_t size, UBYTE value);
+void ami_memory_clear_free(void *p);
+
+/* Standard memory allocation - to be removed */
void *ami_misc_allocvec_clear(int size, UBYTE value);
/* Itempool cross-compatibility */
-----------------------------------------------------------------------
--
NetSurf Browser
6 years, 4 months
netsurf: branch master updated. release/3.6-8-gcdde777
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/cdde777d9cf157460201c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/cdde777d9cf157460201c59...
...tree http://git.netsurf-browser.org/netsurf.git/tree/cdde777d9cf157460201c59c5...
The branch, master has been updated
via cdde777d9cf157460201c59c5cc05c7479c3f830 (commit)
via 4b1b79582c5de530100b4ddb909163a6fb9b23c8 (commit)
via 6951d2327b0f0b6999f66452d5c38d74136cdb12 (commit)
via ec239402eac198af635f14970bf411e5690dd02e (commit)
from d3c7d410a87f02956523b64bc5af380804e67690 (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=cdde777d9cf15746020...
commit cdde777d9cf157460201c59c5cc05c7479c3f830
Merge: d3c7d41 4b1b795
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Move memory functions to own file
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4b1b79582c5de530100...
commit 4b1b79582c5de530100b4ddb909163a6fb9b23c8
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Move slab size def into memory.c
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
index a77d0cc..874f852 100755
--- a/frontends/amiga/memory.c
+++ b/frontends/amiga/memory.c
@@ -21,6 +21,10 @@
#include "amiga/memory.h"
+#ifndef __amigaos4__
+ULONG __slab_max_size = 8192; /* Enable clib2's slab allocator */
+#endif
+
void *ami_misc_allocvec_clear(int size, UBYTE value)
{
#ifdef __amigaos4__
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
index 29a7ae1..1c51f30 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -21,6 +21,7 @@
#include <exec/types.h>
+/* Standard memory allocation */
void *ami_misc_allocvec_clear(int size, UBYTE value);
/* Itempool cross-compatibility */
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 2eda5ff..feb5c29 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -69,6 +69,7 @@
#include "amiga/libs.h"
#include "amiga/menu.h"
#include "amiga/memory.h"
+#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/print.h"
#include "amiga/search.h"
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index 6722ca8..bdf6333 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -46,8 +46,6 @@
#define FAILURE (FALSE)
#define NO !
-ULONG __slab_max_size = 8192; /* Enable clib2's slab allocator */
-
/* Diskfont */
struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
{
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 842e1bb..073a95f 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -46,6 +46,7 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/memory.h"
+#include "amiga/misc.h"
#include "amiga/rtg.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 460eb22..eea64ff 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -67,6 +67,7 @@
#include "amiga/file.h"
#include "amiga/libs.h"
#include "amiga/memory.h"
+#include "amiga/misc.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
#include "amiga/drag.h" /* drag icon stuff */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6951d2327b0f0b6999f...
commit 6951d2327b0f0b6999f66452d5c38d74136cdb12
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Add memory.c/h
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
new file mode 100755
index 0000000..a77d0cc
--- /dev/null
+++ b/frontends/amiga/memory.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2016 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <proto/exec.h>
+
+#include "amiga/memory.h"
+
+void *ami_misc_allocvec_clear(int size, UBYTE value)
+{
+#ifdef __amigaos4__
+ return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
+#else
+ void *mem = AllocVec(size, MEMF_ANY);
+ if (mem) memset(mem, value, size);
+ return mem;
+#endif
+}
+
+APTR ami_misc_itempool_create(int size)
+{
+#ifdef __amigaos4__
+ return AllocSysObjectTags(ASOT_ITEMPOOL,
+ ASOITEM_MFlags, MEMF_PRIVATE,
+ ASOITEM_ItemSize, size,
+ ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
+ ASOITEM_GCParameter, 100,
+ TAG_DONE);
+#else
+ return CreatePool(MEMF_ANY, 20 * size, size);
+#endif
+}
+
+void ami_misc_itempool_delete(APTR pool)
+{
+#ifdef __amigaos4__
+ FreeSysObject(ASOT_ITEMPOOL, pool);
+#else
+ DeletePool(pool);
+#endif
+}
+
+APTR ami_misc_itempool_alloc(APTR pool, int size)
+{
+#ifdef __amigaos4__
+ return ItemPoolAlloc(pool);
+#else
+ return AllocPooled(pool, size);
+#endif
+}
+
+void ami_misc_itempool_free(APTR restrict pool, APTR restrict item, int size)
+{
+#ifdef __amigaos4__
+ ItemPoolFree(pool, item);
+#else
+ FreePooled(pool, item, size);
+#endif
+}
+
diff --git a/frontends/amiga/memory.h b/frontends/amiga/memory.h
new file mode 100644
index 0000000..29a7ae1
--- /dev/null
+++ b/frontends/amiga/memory.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2016 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AMIGA_MEMORY_H
+#define AMIGA_MEMORY_H
+
+#include <exec/types.h>
+
+void *ami_misc_allocvec_clear(int size, UBYTE value);
+
+/* Itempool cross-compatibility */
+APTR ami_misc_itempool_create(int size);
+void ami_misc_itempool_delete(APTR pool);
+APTR ami_misc_itempool_alloc(APTR pool, int size);
+void ami_misc_itempool_free(APTR pool, APTR item, int size);
+#endif
+
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ec239402eac198af635...
commit ec239402eac198af635f14970bf411e5690dd02e
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Move memory functions from misc.c to memory.c
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index a2c1b13..ea6e8fe 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -37,7 +37,7 @@ MESSAGES_FILTER=ami
# sources purely for the Amiga build
S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
- misc.c bitmap.c font.c filetype.c utf8.c login.c \
+ misc.c bitmap.c font.c filetype.c utf8.c login.c memory.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c ctxmenu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 062f00b..ad2d237 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -42,6 +42,7 @@
#include "amiga/hotlist.h"
#include "amiga/tree.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 8c691ed..7609d94 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -54,6 +54,7 @@
#include "amiga/gui.h"
#include "amiga/bitmap.h"
#include "amiga/plotters.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/rtg.h"
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 2dce068..4933f59 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -45,7 +45,7 @@
#include "amiga/iff_cset.h"
#include "amiga/iff_dr2d.h"
#include "amiga/menu.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/utf8.h"
#define ID_UTF8 MAKE_ID('U','T','F','8')
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 93536f4..0750e5e 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -64,6 +64,7 @@
#include "amiga/file.h"
#include "amiga/iff_dr2d.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 1946788..3175cf1 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -46,7 +46,7 @@
#include "amiga/bitmap.h"
#include "amiga/filetype.h"
#include "amiga/datatypes.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/plotters.h"
typedef struct amiga_dt_anim_content {
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 1bba30e..db0e716 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -40,6 +40,7 @@
#include "amiga/filetype.h"
#include "amiga/icon.h"
#include "amiga/iff_dr2d.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/save_pdf.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index 61e4929..8c658ee 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -31,7 +31,7 @@
#include "utils/utils.h"
#include "amiga/filetype.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/object.h"
/**
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index 48e49f3..bb0adb5 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -41,6 +41,7 @@
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/font.h"
#include "amiga/font_bullet.h"
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 459e768..df03756 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -141,6 +141,7 @@
#include "amiga/libs.h"
#include "amiga/login.h"
#include "amiga/menu.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/plotters.h"
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 2b1b7c9..a890a91 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -73,7 +73,7 @@
#include "amiga/gui_options.h"
#include "amiga/help.h"
#include "amiga/libs.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/nsoption.h"
#include "amiga/object.h"
#include "amiga/selectmenu.h"
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index c87b563..fa5c249 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -51,6 +51,7 @@
#include "graphics/rpattr.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
#include "amiga/plotters.h"
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index 7b73360..bd79a55 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -49,7 +49,7 @@
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
#include "amiga/icon.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */
#define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index aea7738..1c8d7db 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -30,7 +30,7 @@
#include "netsurf/content.h"
#include "amiga/os3support.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#else
#include "os3support.h"
#include "iff_dr2d.h"
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 3b338bf..e1d2891 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,7 +46,7 @@
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/object.h"
#include "amiga/login.h"
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 0fd730e..2eda5ff 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -68,7 +68,7 @@
#include "amiga/hotlist.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/nsoption.h"
#include "amiga/print.h"
#include "amiga/search.h"
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index c09b283..5ca4f90 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -42,58 +42,6 @@
#include "amiga/misc.h"
#include "amiga/utf8.h"
-void *ami_misc_allocvec_clear(int size, UBYTE value)
-{
-#ifdef __amigaos4__
- return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
-#else
- void *mem = AllocVec(size, MEMF_ANY);
- if (mem) memset(mem, value, size);
- return mem;
-#endif
-}
-
-APTR ami_misc_itempool_create(int size)
-{
-#ifdef __amigaos4__
- return AllocSysObjectTags(ASOT_ITEMPOOL,
- ASOITEM_MFlags, MEMF_PRIVATE,
- ASOITEM_ItemSize, size,
- ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
- ASOITEM_GCParameter, 100,
- TAG_DONE);
-#else
- return CreatePool(MEMF_ANY, 20 * size, size);
-#endif
-}
-
-void ami_misc_itempool_delete(APTR pool)
-{
-#ifdef __amigaos4__
- FreeSysObject(ASOT_ITEMPOOL, pool);
-#else
- DeletePool(pool);
-#endif
-}
-
-APTR ami_misc_itempool_alloc(APTR pool, int size)
-{
-#ifdef __amigaos4__
- return ItemPoolAlloc(pool);
-#else
- return AllocPooled(pool, size);
-#endif
-}
-
-void ami_misc_itempool_free(APTR restrict pool, APTR restrict item, int size)
-{
-#ifdef __amigaos4__
- ItemPoolFree(pool, item);
-#else
- FreePooled(pool, item, size);
-#endif
-}
-
static LONG ami_misc_req(const char *message, uint32 type)
{
LONG ret = 0;
diff --git a/frontends/amiga/misc.h b/frontends/amiga/misc.h
index c7ae5af..a749794 100644
--- a/frontends/amiga/misc.h
+++ b/frontends/amiga/misc.h
@@ -35,15 +35,6 @@ struct Window;
* faliure displaying the message to the user.
*/
nserror amiga_warn_user(const char *warning, const char *detail);
-
-void *ami_misc_allocvec_clear(int size, UBYTE value);
-
-/* Itempool cross-compatibility */
-APTR ami_misc_itempool_create(int size);
-void ami_misc_itempool_delete(APTR pool);
-APTR ami_misc_itempool_alloc(APTR pool, int size);
-void ami_misc_itempool_free(APTR pool, APTR item, int size);
-
char *translate_escape_chars(const char *s);
void ami_misc_fatal_error(const char *message);
int32 amiga_warn_user_multi(const char *body,
diff --git a/frontends/amiga/object.c b/frontends/amiga/object.c
index 6459d63..074ad92 100755
--- a/frontends/amiga/object.c
+++ b/frontends/amiga/object.c
@@ -26,7 +26,7 @@
#include <exec/lists.h>
#include <exec/nodes.h>
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/object.h"
#ifdef __amigaos4__
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 1917171..842e1bb 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -45,7 +45,7 @@
#include "amiga/bitmap.h"
#include "amiga/font.h"
#include "amiga/gui.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/rtg.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 6926647..7c0dfd9 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -62,6 +62,7 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/print.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index 707d7bb..bfafe9c 100644
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -30,7 +30,7 @@
#include "utils/errors.h"
#include "utils/log.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/schedule.h"
struct nscallback
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 429545e..7a49919 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -56,7 +56,7 @@
#include "amiga/libs.h"
#include "amiga/gui.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/search.h"
#include "amiga/object.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 4042d1d..5f44a9b 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -49,7 +49,7 @@
#include "amiga/bitmap.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
static struct BitMap *throbber = NULL;
static struct bitmap *throbber_nsbm = NULL;
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 8328194..460eb22 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -66,7 +66,7 @@
#include "amiga/tree.h"
#include "amiga/file.h"
#include "amiga/libs.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
#include "amiga/drag.h" /* drag icon stuff */
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/Makefile | 2 +-
frontends/amiga/arexx.c | 1 +
frontends/amiga/bitmap.c | 1 +
frontends/amiga/clipboard.c | 2 +-
frontends/amiga/download.c | 1 +
frontends/amiga/dt_anim.c | 2 +-
frontends/amiga/file.c | 1 +
frontends/amiga/filetype.c | 2 +-
frontends/amiga/font_bullet.c | 1 +
frontends/amiga/gui.c | 1 +
frontends/amiga/gui_options.c | 2 +-
frontends/amiga/history_local.c | 1 +
frontends/amiga/icon.c | 2 +-
frontends/amiga/iff_dr2d.c | 2 +-
frontends/amiga/login.c | 2 +-
frontends/amiga/memory.c | 79 ++++++++++++++++++++++++++++++
frontends/amiga/{nsoption.h => memory.h} | 19 ++++---
frontends/amiga/menu.c | 1 +
frontends/amiga/misc.c | 52 --------------------
frontends/amiga/misc.h | 9 ----
frontends/amiga/object.c | 2 +-
frontends/amiga/os3support.c | 2 -
frontends/amiga/plotters.c | 1 +
frontends/amiga/print.c | 1 +
frontends/amiga/schedule.c | 2 +-
frontends/amiga/search.c | 2 +-
frontends/amiga/theme.c | 2 +-
frontends/amiga/tree.c | 1 +
28 files changed, 114 insertions(+), 82 deletions(-)
create mode 100755 frontends/amiga/memory.c
copy frontends/amiga/{nsoption.h => memory.h} (65%)
diff --git a/frontends/amiga/Makefile b/frontends/amiga/Makefile
index a2c1b13..ea6e8fe 100644
--- a/frontends/amiga/Makefile
+++ b/frontends/amiga/Makefile
@@ -37,7 +37,7 @@ MESSAGES_FILTER=ami
# sources purely for the Amiga build
S_FRONTEND := gui.c tree.c history.c hotlist.c schedule.c file.c \
- misc.c bitmap.c font.c filetype.c utf8.c login.c \
+ misc.c bitmap.c font.c filetype.c utf8.c login.c memory.c \
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
cookies.c ctxmenu.c clipboard.c help.c font_scan.c \
launch.c search.c history_local.c download.c iff_dr2d.c \
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 062f00b..ad2d237 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -42,6 +42,7 @@
#include "amiga/hotlist.h"
#include "amiga/tree.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 8c691ed..7609d94 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -54,6 +54,7 @@
#include "amiga/gui.h"
#include "amiga/bitmap.h"
#include "amiga/plotters.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/rtg.h"
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 2dce068..4933f59 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -45,7 +45,7 @@
#include "amiga/iff_cset.h"
#include "amiga/iff_dr2d.h"
#include "amiga/menu.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/utf8.h"
#define ID_UTF8 MAKE_ID('U','T','F','8')
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index 93536f4..0750e5e 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -64,6 +64,7 @@
#include "amiga/file.h"
#include "amiga/iff_dr2d.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 1946788..3175cf1 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -46,7 +46,7 @@
#include "amiga/bitmap.h"
#include "amiga/filetype.h"
#include "amiga/datatypes.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/plotters.h"
typedef struct amiga_dt_anim_content {
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 1bba30e..db0e716 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -40,6 +40,7 @@
#include "amiga/filetype.h"
#include "amiga/icon.h"
#include "amiga/iff_dr2d.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/save_pdf.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index 61e4929..8c658ee 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -31,7 +31,7 @@
#include "utils/utils.h"
#include "amiga/filetype.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/object.h"
/**
diff --git a/frontends/amiga/font_bullet.c b/frontends/amiga/font_bullet.c
index 48e49f3..bb0adb5 100644
--- a/frontends/amiga/font_bullet.c
+++ b/frontends/amiga/font_bullet.c
@@ -41,6 +41,7 @@
#include "utils/utf8.h"
#include "utils/utils.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/font.h"
#include "amiga/font_bullet.h"
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 459e768..df03756 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -141,6 +141,7 @@
#include "amiga/libs.h"
#include "amiga/login.h"
#include "amiga/menu.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/plotters.h"
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 2b1b7c9..a890a91 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -73,7 +73,7 @@
#include "amiga/gui_options.h"
#include "amiga/help.h"
#include "amiga/libs.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/nsoption.h"
#include "amiga/object.h"
#include "amiga/selectmenu.h"
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index c87b563..fa5c249 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -51,6 +51,7 @@
#include "graphics/rpattr.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/object.h"
#include "amiga/plotters.h"
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index 7b73360..bd79a55 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -49,7 +49,7 @@
#include "amiga/os3support.h"
#include "amiga/bitmap.h"
#include "amiga/icon.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#define THUMBNAIL_WIDTH 100 /* Icon sizes for thumbnails, usually the same as */
#define THUMBNAIL_HEIGHT 86 /* WIDTH/HEIGHT in desktop/thumbnail.c */
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index aea7738..1c8d7db 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -30,7 +30,7 @@
#include "netsurf/content.h"
#include "amiga/os3support.h"
#include "amiga/iff_dr2d.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#else
#include "os3support.h"
#include "iff_dr2d.h"
diff --git a/frontends/amiga/login.c b/frontends/amiga/login.c
index 3b338bf..e1d2891 100755
--- a/frontends/amiga/login.c
+++ b/frontends/amiga/login.c
@@ -46,7 +46,7 @@
#include "amiga/gui.h"
#include "amiga/libs.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/object.h"
#include "amiga/login.h"
diff --git a/frontends/amiga/memory.c b/frontends/amiga/memory.c
new file mode 100755
index 0000000..874f852
--- /dev/null
+++ b/frontends/amiga/memory.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2016 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+#include <proto/exec.h>
+
+#include "amiga/memory.h"
+
+#ifndef __amigaos4__
+ULONG __slab_max_size = 8192; /* Enable clib2's slab allocator */
+#endif
+
+void *ami_misc_allocvec_clear(int size, UBYTE value)
+{
+#ifdef __amigaos4__
+ return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
+#else
+ void *mem = AllocVec(size, MEMF_ANY);
+ if (mem) memset(mem, value, size);
+ return mem;
+#endif
+}
+
+APTR ami_misc_itempool_create(int size)
+{
+#ifdef __amigaos4__
+ return AllocSysObjectTags(ASOT_ITEMPOOL,
+ ASOITEM_MFlags, MEMF_PRIVATE,
+ ASOITEM_ItemSize, size,
+ ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
+ ASOITEM_GCParameter, 100,
+ TAG_DONE);
+#else
+ return CreatePool(MEMF_ANY, 20 * size, size);
+#endif
+}
+
+void ami_misc_itempool_delete(APTR pool)
+{
+#ifdef __amigaos4__
+ FreeSysObject(ASOT_ITEMPOOL, pool);
+#else
+ DeletePool(pool);
+#endif
+}
+
+APTR ami_misc_itempool_alloc(APTR pool, int size)
+{
+#ifdef __amigaos4__
+ return ItemPoolAlloc(pool);
+#else
+ return AllocPooled(pool, size);
+#endif
+}
+
+void ami_misc_itempool_free(APTR restrict pool, APTR restrict item, int size)
+{
+#ifdef __amigaos4__
+ ItemPoolFree(pool, item);
+#else
+ FreePooled(pool, item, size);
+#endif
+}
+
diff --git a/frontends/amiga/nsoption.h b/frontends/amiga/memory.h
similarity index 65%
copy from frontends/amiga/nsoption.h
copy to frontends/amiga/memory.h
index c3a3b56..1c51f30 100644
--- a/frontends/amiga/nsoption.h
+++ b/frontends/amiga/memory.h
@@ -16,13 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_NSOPTION_H
-#define AMIGA_NSOPTION_H 1
-#include "utils/errors.h"
+#ifndef AMIGA_MEMORY_H
+#define AMIGA_MEMORY_H
-nserror ami_nsoption_read(void);
-nserror ami_nsoption_write(void);
-nserror ami_nsoption_set_location(const char *current_user_dir);
-void ami_nsoption_free(void);
+#include <exec/types.h>
+
+/* Standard memory allocation */
+void *ami_misc_allocvec_clear(int size, UBYTE value);
+
+/* Itempool cross-compatibility */
+APTR ami_misc_itempool_create(int size);
+void ami_misc_itempool_delete(APTR pool);
+APTR ami_misc_itempool_alloc(APTR pool, int size);
+void ami_misc_itempool_free(APTR pool, APTR item, int size);
#endif
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index 0fd730e..feb5c29 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -68,6 +68,7 @@
#include "amiga/hotlist.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/nsoption.h"
#include "amiga/print.h"
diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index c09b283..5ca4f90 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -42,58 +42,6 @@
#include "amiga/misc.h"
#include "amiga/utf8.h"
-void *ami_misc_allocvec_clear(int size, UBYTE value)
-{
-#ifdef __amigaos4__
- return AllocVecTags(size, AVT_ClearWithValue, value, TAG_DONE);
-#else
- void *mem = AllocVec(size, MEMF_ANY);
- if (mem) memset(mem, value, size);
- return mem;
-#endif
-}
-
-APTR ami_misc_itempool_create(int size)
-{
-#ifdef __amigaos4__
- return AllocSysObjectTags(ASOT_ITEMPOOL,
- ASOITEM_MFlags, MEMF_PRIVATE,
- ASOITEM_ItemSize, size,
- ASOITEM_GCPolicy, ITEMGC_AFTERCOUNT,
- ASOITEM_GCParameter, 100,
- TAG_DONE);
-#else
- return CreatePool(MEMF_ANY, 20 * size, size);
-#endif
-}
-
-void ami_misc_itempool_delete(APTR pool)
-{
-#ifdef __amigaos4__
- FreeSysObject(ASOT_ITEMPOOL, pool);
-#else
- DeletePool(pool);
-#endif
-}
-
-APTR ami_misc_itempool_alloc(APTR pool, int size)
-{
-#ifdef __amigaos4__
- return ItemPoolAlloc(pool);
-#else
- return AllocPooled(pool, size);
-#endif
-}
-
-void ami_misc_itempool_free(APTR restrict pool, APTR restrict item, int size)
-{
-#ifdef __amigaos4__
- ItemPoolFree(pool, item);
-#else
- FreePooled(pool, item, size);
-#endif
-}
-
static LONG ami_misc_req(const char *message, uint32 type)
{
LONG ret = 0;
diff --git a/frontends/amiga/misc.h b/frontends/amiga/misc.h
index c7ae5af..a749794 100644
--- a/frontends/amiga/misc.h
+++ b/frontends/amiga/misc.h
@@ -35,15 +35,6 @@ struct Window;
* faliure displaying the message to the user.
*/
nserror amiga_warn_user(const char *warning, const char *detail);
-
-void *ami_misc_allocvec_clear(int size, UBYTE value);
-
-/* Itempool cross-compatibility */
-APTR ami_misc_itempool_create(int size);
-void ami_misc_itempool_delete(APTR pool);
-APTR ami_misc_itempool_alloc(APTR pool, int size);
-void ami_misc_itempool_free(APTR pool, APTR item, int size);
-
char *translate_escape_chars(const char *s);
void ami_misc_fatal_error(const char *message);
int32 amiga_warn_user_multi(const char *body,
diff --git a/frontends/amiga/object.c b/frontends/amiga/object.c
index 6459d63..074ad92 100755
--- a/frontends/amiga/object.c
+++ b/frontends/amiga/object.c
@@ -26,7 +26,7 @@
#include <exec/lists.h>
#include <exec/nodes.h>
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/object.h"
#ifdef __amigaos4__
diff --git a/frontends/amiga/os3support.c b/frontends/amiga/os3support.c
index 6722ca8..bdf6333 100644
--- a/frontends/amiga/os3support.c
+++ b/frontends/amiga/os3support.c
@@ -46,8 +46,6 @@
#define FAILURE (FALSE)
#define NO !
-ULONG __slab_max_size = 8192; /* Enable clib2's slab allocator */
-
/* Diskfont */
struct OutlineFont *OpenOutlineFont(STRPTR fileName, struct List *list, ULONG flags)
{
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index 1917171..073a95f 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -45,6 +45,7 @@
#include "amiga/bitmap.h"
#include "amiga/font.h"
#include "amiga/gui.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/rtg.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 6926647..7c0dfd9 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -62,6 +62,7 @@
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/print.h"
#include "amiga/utf8.h"
diff --git a/frontends/amiga/schedule.c b/frontends/amiga/schedule.c
index 707d7bb..bfafe9c 100644
--- a/frontends/amiga/schedule.c
+++ b/frontends/amiga/schedule.c
@@ -30,7 +30,7 @@
#include "utils/errors.h"
#include "utils/log.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/schedule.h"
struct nscallback
diff --git a/frontends/amiga/search.c b/frontends/amiga/search.c
index 429545e..7a49919 100755
--- a/frontends/amiga/search.c
+++ b/frontends/amiga/search.c
@@ -56,7 +56,7 @@
#include "amiga/libs.h"
#include "amiga/gui.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
#include "amiga/search.h"
#include "amiga/object.h"
#include "amiga/theme.h"
diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c
index 4042d1d..5f44a9b 100644
--- a/frontends/amiga/theme.c
+++ b/frontends/amiga/theme.c
@@ -49,7 +49,7 @@
#include "amiga/bitmap.h"
#include "amiga/schedule.h"
#include "amiga/theme.h"
-#include "amiga/misc.h"
+#include "amiga/memory.h"
static struct BitMap *throbber = NULL;
static struct bitmap *throbber_nsbm = NULL;
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 8328194..eea64ff 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -66,6 +66,7 @@
#include "amiga/tree.h"
#include "amiga/file.h"
#include "amiga/libs.h"
+#include "amiga/memory.h"
#include "amiga/misc.h"
#include "amiga/utf8.h"
#include "amiga/sslcert.h"
--
NetSurf Browser
6 years, 4 months