From c1671f37b1a6b8872d736bfdcee25770dbbd5a06 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 3 Oct 2012 19:24:58 +0100 Subject: reduce talloc usage to box tree layout only --- image/bmp.c | 9 ++++----- image/gif.c | 9 ++++----- image/ico.c | 9 ++++----- image/jpeg.c | 7 +++---- image/mng.c | 9 ++++----- image/nssprite.c | 7 +++---- image/png.c | 18 +++++++++++------- image/rsvg.c | 9 ++++----- image/svg.c | 9 ++++----- image/video.c | 9 ++++----- image/webp.c | 7 +++---- 11 files changed, 48 insertions(+), 54 deletions(-) (limited to 'image') diff --git a/image/bmp.c b/image/bmp.c index aea6d26fc..9ca86fd82 100644 --- a/image/bmp.c +++ b/image/bmp.c @@ -33,7 +33,6 @@ #include "desktop/plotters.h" #include "utils/log.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/utils.h" #include "image/bitmap.h" @@ -72,20 +71,20 @@ static nserror nsbmp_create(const content_handler *handler, nsbmp_content *bmp; nserror error; - bmp = talloc_zero(0, nsbmp_content); + bmp = calloc(1, sizeof(nsbmp_content)); if (bmp == NULL) return NSERROR_NOMEM; error = content__init(&bmp->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(bmp); + free(bmp); return error; } error = nsbmp_create_bmp_data(bmp); if (error != NSERROR_OK) { - talloc_free(bmp); + free(bmp); return error; } @@ -214,7 +213,7 @@ static nserror nsbmp_clone(const struct content *old, struct content **newc) nsbmp_content *new_bmp; nserror error; - new_bmp = talloc_zero(0, nsbmp_content); + new_bmp = calloc(1, sizeof(nsbmp_content)); if (new_bmp == NULL) return NSERROR_NOMEM; diff --git a/image/gif.c b/image/gif.c index d92eede85..b3781f837 100644 --- a/image/gif.c +++ b/image/gif.c @@ -45,7 +45,6 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/schedule.h" -#include "utils/talloc.h" #include "utils/utils.h" typedef struct nsgif_content { @@ -105,20 +104,20 @@ static nserror nsgif_create(const content_handler *handler, nsgif_content *result; nserror error; - result = talloc_zero(0, nsgif_content); + result = calloc(1, sizeof(nsgif_content)); if (result == NULL) return NSERROR_NOMEM; error = content__init(&result->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(result); + free(result); return error; } error = nsgif_create_gif_data(result); if (error != NSERROR_OK) { - talloc_free(result); + free(result); return error; } @@ -367,7 +366,7 @@ static nserror nsgif_clone(const struct content *old, struct content **newc) nsgif_content *gif; nserror error; - gif = talloc_zero(0, nsgif_content); + gif = calloc(1, sizeof(nsgif_content)); if (gif == NULL) return NSERROR_NOMEM; diff --git a/image/ico.c b/image/ico.c index 65a85c2d4..b9abd7d1c 100644 --- a/image/ico.c +++ b/image/ico.c @@ -35,7 +35,6 @@ #include "image/image.h" #include "utils/log.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/utils.h" typedef struct nsico_content { @@ -69,20 +68,20 @@ static nserror nsico_create(const content_handler *handler, nsico_content *result; nserror error; - result = talloc_zero(0, nsico_content); + result = calloc(1, sizeof(nsico_content)); if (result == NULL) return NSERROR_NOMEM; error = content__init(&result->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(result); + free(result); return error; } error = nsico_create_ico_data(result); if (error != NSERROR_OK) { - talloc_free(result); + free(result); return error; } @@ -190,7 +189,7 @@ static nserror nsico_clone(const struct content *old, struct content **newc) nsico_content *ico; nserror error; - ico = talloc_zero(0, nsico_content); + ico = calloc(1, sizeof(nsico_content)); if (ico == NULL) return NSERROR_NOMEM; diff --git a/image/jpeg.c b/image/jpeg.c index 27d79bb11..82fde0dd1 100644 --- a/image/jpeg.c +++ b/image/jpeg.c @@ -35,7 +35,6 @@ #include "utils/log.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/types.h" #include "utils/utils.h" @@ -72,14 +71,14 @@ static nserror nsjpeg_create(const content_handler *handler, struct content *jpeg; nserror error; - jpeg = talloc_zero(0, struct content); + jpeg = calloc(1, sizeof(struct content)); if (jpeg == NULL) return NSERROR_NOMEM; error = content__init(jpeg, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(jpeg); + free(jpeg); return error; } @@ -347,7 +346,7 @@ static nserror nsjpeg_clone(const struct content *old, struct content **newc) struct content *jpeg_c; nserror error; - jpeg_c = talloc_zero(0, struct content); + jpeg_c = calloc(1, sizeof(struct content)); if (jpeg_c == NULL) return NSERROR_NOMEM; diff --git a/image/mng.c b/image/mng.c index 8d9769b70..67625f026 100644 --- a/image/mng.c +++ b/image/mng.c @@ -35,7 +35,6 @@ #include "utils/log.h" #include "utils/messages.h" #include "utils/schedule.h" -#include "utils/talloc.h" #include "utils/utils.h" /* This implementation does not currently support dynamic MNGs or any @@ -513,20 +512,20 @@ static nserror nsmng_create(const content_handler *handler, nsmng_content *mng; nserror error; - mng = talloc_zero(0, nsmng_content); + mng = calloc(1, sizeof(nsmng_content)); if (mng == NULL) return NSERROR_NOMEM; error = content__init(&mng->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(mng); + free(mng); return error; } error = nsmng_create_mng_data(mng); if (error != NSERROR_OK) { - talloc_free(mng); + free(mng); return error; } @@ -728,7 +727,7 @@ static nserror nsmng_clone(const struct content *old, struct content **newc) const char *data; unsigned long size; - mng = talloc_zero(0, nsmng_content); + mng = calloc(1, sizeof(nsmng_content)); if (mng == NULL) return NSERROR_NOMEM; diff --git a/image/nssprite.c b/image/nssprite.c index a83d94378..ea05c8fe0 100644 --- a/image/nssprite.c +++ b/image/nssprite.c @@ -32,7 +32,6 @@ #include "image/nssprite.h" #include "utils/log.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/utils.h" typedef struct nssprite_content { @@ -68,14 +67,14 @@ static nserror nssprite_create(const content_handler *handler, nssprite_content *sprite; nserror error; - sprite = talloc_zero(0, nssprite_content); + sprite = calloc(1, sizeof(nssprite_content)); if (sprite == NULL) return NSERROR_NOMEM; error = content__init(&sprite->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(sprite); + free(sprite); return error; } @@ -199,7 +198,7 @@ static nserror nssprite_clone(const struct content *old, struct content **newc) nssprite_content *sprite; nserror error; - sprite = talloc_zero(0, nssprite_content); + sprite = calloc(1, sizeof(nssprite_content)); if (sprite == NULL) return NSERROR_NOMEM; diff --git a/image/png.c b/image/png.c index 829eee272..6f1d926ee 100644 --- a/image/png.c +++ b/image/png.c @@ -35,7 +35,6 @@ #include "utils/log.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/utils.h" /* accommodate for old versions of libpng (beware security holes!) */ @@ -291,20 +290,25 @@ static nserror nspng_create(const content_handler *handler, nspng_content *png_c; nserror error; - png_c = talloc_zero(0, nspng_content); + png_c = calloc(1, sizeof(nspng_content)); if (png_c == NULL) return NSERROR_NOMEM; - error = content__init(&png_c->base, handler, imime_type, params, - llcache, fallback_charset, quirks); + error = content__init(&png_c->base, + handler, + imime_type, + params, + llcache, + fallback_charset, + quirks); if (error != NSERROR_OK) { - talloc_free(png_c); + free(png_c); return error; } error = nspng_create_png_data(png_c); if (error != NSERROR_OK) { - talloc_free(png_c); + free(png_c); return error; } @@ -542,7 +546,7 @@ static nserror nspng_clone(const struct content *old_c, struct content **new_c) const char *data; unsigned long size; - clone_png_c = talloc_zero(0, nspng_content); + clone_png_c = calloc(1, sizeof(nspng_content)); if (clone_png_c == NULL) return NSERROR_NOMEM; diff --git a/image/rsvg.c b/image/rsvg.c index d70364703..2e41fdd59 100644 --- a/image/rsvg.c +++ b/image/rsvg.c @@ -41,7 +41,6 @@ #include "utils/log.h" #include "utils/utils.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "image/rsvg.h" @@ -82,20 +81,20 @@ static nserror rsvg_create(const content_handler *handler, rsvg_content *svg; nserror error; - svg = talloc_zero(0, rsvg_content); + svg = calloc(1, sizeof(rsvg_content)); if (svg == NULL) return NSERROR_NOMEM; error = content__init(&svg->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(svg); + free(svg); return error; } error = rsvg_create_svg_data(svg); if (error != NSERROR_OK) { - talloc_free(svg); + free(svg); return error; } @@ -252,7 +251,7 @@ static nserror rsvg_clone(const struct content *old, struct content **newc) const char *data; unsigned long size; - svg = talloc_zero(0, rsvg_content); + svg = calloc(1, sizeof(rsvg_content)); if (svg == NULL) return NSERROR_NOMEM; diff --git a/image/svg.c b/image/svg.c index 5e21c84c5..971ab764e 100644 --- a/image/svg.c +++ b/image/svg.c @@ -30,7 +30,6 @@ #include "desktop/plotters.h" #include "image/svg.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/utils.h" typedef struct svg_content { @@ -73,20 +72,20 @@ static nserror svg_create(const content_handler *handler, svg_content *svg; nserror error; - svg = talloc_zero(0, svg_content); + svg = calloc(1, sizeof(svg_content)); if (svg == NULL) return NSERROR_NOMEM; error = content__init(&svg->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(svg); + free(svg); return error; } error = svg_create_svg_data(svg); if (error != NSERROR_OK) { - talloc_free(svg); + free(svg); return error; } @@ -290,7 +289,7 @@ static nserror svg_clone(const struct content *old, struct content **newc) svg_content *svg; nserror error; - svg = talloc_zero(0, svg_content); + svg = calloc(1, sizeof(svg_content)); if (svg == NULL) return NSERROR_NOMEM; diff --git a/image/video.c b/image/video.c index 2255208c3..1cbbeebf0 100644 --- a/image/video.c +++ b/image/video.c @@ -21,7 +21,6 @@ #include "content/content_factory.h" #include "content/content_protected.h" #include "image/video.h" -#include "utils/talloc.h" typedef struct nsvideo_content { struct content base; @@ -76,26 +75,26 @@ static nserror nsvideo_create(const content_handler *handler, nserror error; GstBus *bus; - video = talloc_zero(0, nsvideo_content); + video = calloc(1, sizeof(nsvideo_content)); if (video == NULL) return NSERROR_NOMEM; error = content__init(&video->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(video); + free(video); return error; } error = llcache_handle_force_stream(llcache); if (error != NSERROR_OK) { - talloc_free(video); + free(video); return error; } video->playbin = gst_element_factory_make("playbin2", NULL); if (video->playbin == NULL) { - talloc_free(video); + free(video); return NSERROR_NOMEM; } diff --git a/image/webp.c b/image/webp.c index eba155492..080cf8bb0 100644 --- a/image/webp.c +++ b/image/webp.c @@ -30,7 +30,6 @@ #include "content/content_protected.h" #include "utils/log.h" #include "utils/messages.h" -#include "utils/talloc.h" #include "utils/utils.h" typedef struct webp_content @@ -49,14 +48,14 @@ static nserror webp_create(const content_handler *handler, webp_content *webp; nserror error; - webp = talloc_zero(0, webp_content); + webp = calloc(1, sizeof(webp_content)); if (webp == NULL) return NSERROR_NOMEM; error = content__init(&webp->base, handler, imime_type, params, llcache, fallback_charset, quirks); if (error != NSERROR_OK) { - talloc_free(webp); + free(webp); return error; } @@ -169,7 +168,7 @@ static nserror webp_clone(const struct content *old, struct content **newc) webp_content *webp; nserror error; - webp = talloc_zero(0, webp_content); + webp = calloc(1, sizeof(webp_content)); if (webp == NULL) return NSERROR_NOMEM; -- cgit v1.2.3