summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontends/amiga/arexx.c3
-rw-r--r--frontends/amiga/bitmap.c4
-rw-r--r--frontends/amiga/clipboard.c11
-rw-r--r--frontends/amiga/download.c13
-rw-r--r--frontends/amiga/file.c13
-rw-r--r--frontends/amiga/filetype.c5
-rw-r--r--frontends/amiga/font_bullet.c6
-rw-r--r--frontends/amiga/font_cache.c2
-rw-r--r--frontends/amiga/font_scan.c10
-rw-r--r--frontends/amiga/gui.c37
-rw-r--r--frontends/amiga/gui.h4
-rwxr-xr-xfrontends/amiga/gui_options.c7
-rwxr-xr-xfrontends/amiga/history_local.c7
-rw-r--r--frontends/amiga/icon.c11
-rwxr-xr-xfrontends/amiga/memory.c22
-rw-r--r--frontends/amiga/memory.h10
16 files changed, 94 insertions, 71 deletions
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index ad2d23713..cdb12c200 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 124c116d5..bb4bfc6b9 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 4933f59e7..9489110b7 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 0750e5e83..3eba8935c 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/file.c b/frontends/amiga/file.c
index db0e7162b..04f8e8aca 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 8c658ee81..a0449d848 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 bb0adb5d0..fd41c29a2 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 08c2fe196..3d8330979 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 c1c1732b9..932179e3e 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 df03756f3..24eb9acd4 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 6d5188e44..f0abd4ccc 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 a890a9126..fb5d1b195 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 fa5c249b9..5009ce888 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 fd996ef84..3f597a1ba 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/memory.c b/frontends/amiga/memory.c
index 874f8521e..567f4f5c9 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 1c51f3081..5e6286426 100644
--- a/frontends/amiga/memory.h
+++ b/frontends/amiga/memory.h
@@ -21,7 +21,15 @@
#include <exec/types.h>
-/* Standard memory allocation */
+/* 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);
+
+/* Standard memory allocation - to be removed */
void *ami_misc_allocvec_clear(int size, UBYTE value);
/* Itempool cross-compatibility */