shithub: freetype+ttf2subf

Download patch

ref: 398d64c0cc360c2022ca8fb3df3b15055c2eb0ef
parent: 560d5fed38e757cc56d5c7b3ad79b9f16eca61c1
author: David Turner <[email protected]>
date: Fri Oct 21 06:01:25 EDT 2005

* src/base/ftdbgmem.c: another realloc memory counting bug fix

  * src/tools/Jamfile: adding missing file

  * src/lzw/Jamfile: fixing incorrect source file reference

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-10-21  David Turner  <[email protected]>
+
+  * src/base/ftdbgmem.c: another realloc memory counting bug fix
+
+  * src/tools/Jamfile: adding missing file
+
+  * src/lzw/Jamfile: fixing incorrect source file reference
+
 2005-10-20  David Turner  <[email protected]>
 
 	* src/base/ftdbgmem.c (ft_mem_table_set, ft_mem_table_remove,
@@ -5,8 +13,8 @@
 	to better account for memory reallocations.
 
 	* src/lzw/ftlzw2.c, src/lzw/ftzopen.h, src/lzw/ftzopen.c,
-	src/lzw/rules.mk: First version of LZW loader re-implementation. 
-	Apparently, this saves about 260 KB of heap memory when loading
+	src/lzw/rules.mk: First version of LZW loader re-implementation.
+	Apparently, this saves about 330 KB of heap memory when loading
 	timR24.pcf.Z.
 
 2005-10-20  Chia-I Wu  <[email protected]>
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -554,12 +554,14 @@
       if ( delta != 0 )
       {
         /* we're growing or shrinking a realloc-ed block */
-        source->cur_size += delta;
+        source->cur_size     += delta;
+        table->alloc_current += delta;
       }
       else
       {
         /* we're allocating a new block */
-        source->cur_size += size;
+        source->cur_size     += size;
+        table->alloc_current += size;
       }
 
       source->all_size += size;
@@ -575,16 +577,8 @@
       pnode[0] = node;
       table->nodes++;
 
-      if ( delta != 0 )
-      {
-        table->alloc_total   += size;
-        table->alloc_current += delta;
-      }
-      else
-      {
-        table->alloc_total   += size;
-        table->alloc_current += size;
-      }
+      table->alloc_total += size;
+
       if ( table->alloc_current > table->alloc_max )
         table->alloc_max = table->alloc_current;
 
@@ -742,6 +736,10 @@
     FT_Long      line_no   = table->line_no;
 
 
+    /* unlikely, but possible */
+    if ( new_size == cur_size )
+      return block;
+
     /* the following is valid according to ANSI C */
 #if 0
     if ( block == NULL || cur_size == 0 )
@@ -774,19 +772,6 @@
                           "%ld instead of %ld in (%s:%ld)",
                           block, cur_size, node->size, file_name, line_no );
 
-#if 0
-    new_block = ft_mem_debug_alloc( memory, new_size );
-    if ( new_block == NULL )
-      return NULL;
-
-    ft_memcpy( new_block, block, cur_size < new_size ? cur_size : new_size );
-
-    table->file_name = file_name;
-    table->line_no   = line_no;
-
-    ft_mem_debug_free( memory, (FT_Byte*)block );
-
-#else
     /* return NULL if the maximum number of allocations was reached */
     if ( table->bound_count                           &&
          table->alloc_count >= table->alloc_count_max )
@@ -806,22 +791,15 @@
 
     ft_mem_table_set( table, new_block, new_size, delta );
 
-    table->file_name = NULL;
-    table->line_no   = 0;
-
     ft_memcpy( new_block, block, cur_size < new_size ? cur_size : new_size );
 
-    table->file_name = file_name;
-    table->line_no   = line_no;
-
     ft_mem_table_remove( table, (FT_Byte*)block, delta );
 
+    table->file_name = NULL;
+    table->line_no   = 0;
+
     if ( !table->keep_alive )
       ft_mem_table_free( table, block );
-
-    table->alloc_current += delta;
-
-#endif
 
     return new_block;
   }
--- a/src/lzw/Jamfile
+++ b/src/lzw/Jamfile
@@ -11,7 +11,7 @@
 
 SubDir  FT2_TOP $(FT2_SRC_DIR) lzw ;
 
-Library  $(FT2_LIB) : ftlzw.c ;
+Library  $(FT2_LIB) : ftlzw2.c ;
 
 # end of src/lzw Jamfile
 
--- /dev/null
+++ b/src/tools/Jamfile
@@ -1,0 +1,5 @@
+# Jamfile for src/tools
+#
+SubDir FT2_TOP src tools ;
+
+Main  apinames : apinames.c ;