Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

this patch removes some useless memset(..., 0, ...) of memory that has been calloc'ated
It also improves a bit some formating, (<type>*) --> (<type> *)

It is against :
    vcl/source/fontsubset/sft.cxx


Best regards
Christophe JAILLET
From b81145830995f9808be3ebed3f451cd6befd73db Mon Sep 17 00:00:00 2001
From: Christophe Christophe Marion <christophe.jaillet@wanadoo.fr>
Date: Mon, 18 Jun 2012 22:10:27 +0200
Subject: [PATCH] Remove some useless memset(0)

---
 vcl/source/fontsubset/sft.cxx |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 26f31f2..f21ca6c 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1439,7 +1439,6 @@ static void GetKern(TrueTypeFont *ttf)
         ttf->nkern = GetUInt16(table, 2, 1);
         ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *));
         assert(ttf->kerntables != 0);
-        memset(ttf->kerntables, 0, ttf->nkern * sizeof(sal_uInt8 *));
         ttf->kerntype = KT_MICROSOFT;
         ptr = table + 4;
         for( unsigned i = 0; i < ttf->nkern; ++i) {
@@ -1457,9 +1456,8 @@ static void GetKern(TrueTypeFont *ttf)
 
     if (GetUInt32(table, 0, 1) == 0x00010000) {                       /* MacOS style kern tables: 
fixed32 version and sal_uInt32 nTables fields */
         ttf->nkern = GetUInt32(table, 4, 1);
-        ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8*));
+        ttf->kerntables = (const sal_uInt8**)calloc(ttf->nkern, sizeof(sal_uInt8 *));
         assert(ttf->kerntables != 0);
-        memset(ttf->kerntables, 0, ttf->nkern * sizeof(sal_uInt8 *));
         ttf->kerntype = KT_APPLE_NEW;
         ptr = table + 8;
         for( unsigned i = 0; i < ttf->nkern; ++i) {
@@ -1624,14 +1622,11 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
     if( t->ntables >= 128 )
         return SF_TTFORMAT;
 
-    t->tables = (const sal_uInt8**)calloc(NUM_TAGS, sizeof(sal_uInt8*));
+    t->tables = (const sal_uInt8**)calloc(NUM_TAGS, sizeof(sal_uInt8 *));
     assert(t->tables != 0);
     t->tlens = (sal_uInt32*)calloc(NUM_TAGS, sizeof(sal_uInt32));
     assert(t->tlens != 0);
 
-    memset(t->tables, 0, NUM_TAGS * sizeof(void *));
-    memset(t->tlens, 0, NUM_TAGS * sizeof(sal_uInt32));
-
     /* parse the tables */
     for (i=0; i<(int)t->ntables; i++) {
         int nIndex;
-- 
1.7.9


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.