Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/a8bd2af7103bca7145f8c566ec46f27e2be8d182
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/a8bd2af7103bca7145f8c566ec46f27e2be8d182
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/a8bd2af7103bca7145f8c566ec46f27e2be8d182

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=a8bd2af7103bca7145f8c566ec46f27e2be8d182
commit a8bd2af7103bca7145f8c566ec46f27e2be8d182
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    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

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to