From 05fa29ba8bc2dbfaa9af7ed1263554c7cdc9214d Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 19 Nov 2016 21:40:32 +0000 Subject: more allocvec/malloc changes --- frontends/amiga/bitmap.c | 2 +- frontends/amiga/gui.h | 5 +- frontends/amiga/iff_dr2d.c | 26 ++-- frontends/amiga/launch.c | 10 +- frontends/amiga/login.c | 3 +- frontends/amiga/memory.h | 5 + frontends/amiga/menu.c | 21 ++- frontends/amiga/object.c | 7 +- frontends/amiga/os3support.c | 317 +++++++++++++++++++++---------------------- frontends/amiga/plotters.c | 30 ++-- frontends/amiga/print.c | 17 ++- frontends/amiga/search.c | 2 +- frontends/amiga/theme.c | 16 +-- frontends/amiga/tree.c | 17 ++- 14 files changed, 236 insertions(+), 242 deletions(-) (limited to 'frontends') diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c index bb4bfc6b9..27ffee4cc 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 f0abd4ccc..db3fef208 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 1c8d7db2c..29bb72bf4 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 8020dd6b8..31800ef7a 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 e1d2891c5..805e25ca9 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 5e6286426..dd36a214b 100644 --- a/frontends/amiga/memory.h +++ b/frontends/amiga/memory.h @@ -22,8 +22,13 @@ #include /* 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 feb5c2979..dc5514be9 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 074ad9277..98e0b12b7 100755 --- a/frontends/amiga/object.c +++ b/frontends/amiga/object.c @@ -26,7 +26,6 @@ #include #include -#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 bdf633316..c08260209 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; iti_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; iheight = 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 7c0dfd963..25a4c32f4 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 7a49919be..7725e869c 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 5f44a9bab..5e94ca21d 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 eea64ffea..90497092d 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) { -- cgit v1.2.3