]> git.wh0rd.org - fontconfig.git/commitdiff
Remove stuff we don't use, make get_{char,short,long} functions of ftglue
authorPatrick Lam <plam@MIT.EDU>
Wed, 8 Mar 2006 02:30:43 +0000 (02:30 +0000)
committerPatrick Lam <plam@MIT.EDU>
Wed, 8 Mar 2006 02:30:43 +0000 (02:30 +0000)
    macros to be inlined.
Code cleanups (excess prototype, old-style function definition).
reviewed by: plam

ChangeLog
src/fcfreetype.c
src/fcint.h
src/fcname.c
src/ftglue.c
src/ftglue.h

index 20d8f8530e6b9072654a469350b3fb9fae6215b9..5598eab27384485065c7a7d53f031253730545ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2006-03-07  Behdad Esfahbod  <behdad@cs.toronto.edu>
+       reviewed by: plam
+
+       * src/fcfreetype.c (GetScriptTags):
+       * src/ftglue.c, src/ftglue.h:
+
+       Remove stuff we don't use, make get_{char,short,long} functions
+       of ftglue macros to be inlined.
+       
+       * src/fcint.h:
+       * src/fcname.c (FcObjectSerialize):
+
+       Code cleanups (excess prototype, old-style function definition).
+
 2006-03-05  Patrick Lam  <plam@mit.edu>
        * src/fcpat.c (FcPatternGetString):
 
index 8e98b645ad4df7ba447b479dbfa54d64e4aa0995..455f059a89d43769350be3c39a9f858bb78e9c67 100644 (file)
@@ -2762,7 +2762,7 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *scri
     if ( ftglue_stream_seek ( stream, base_offset + 4L ) || ftglue_stream_frame_enter( stream, 2L ) )
        return error;
 
-    new_offset = ((FT_UShort)ftglue_stream_get_short ( stream )) + base_offset;
+    new_offset = GET_UShort() + base_offset;
 
     ftglue_stream_frame_exit( stream );
 
@@ -2776,7 +2776,7 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *scri
     if ( ftglue_stream_frame_enter( stream, 2L ) )
        return error;
 
-    *script_count = ((FT_UShort)ftglue_stream_get_short ( stream ));
+    *script_count = GET_UShort ();
 
     ftglue_stream_frame_exit( stream );
 
@@ -2791,8 +2791,8 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *scri
         if ( ftglue_stream_frame_enter( stream, 6L ) )
            goto Fail;
 
-       (*stags)[p] = ((FT_ULong)ftglue_stream_get_long ( stream ));
-       new_offset = ((FT_UShort)ftglue_stream_get_short ( stream )) + base_offset;
+       (*stags)[p] = GET_ULong ();
+       new_offset = GET_UShort () + base_offset;
 
         ftglue_stream_frame_exit( stream );
 
index 3f7f15b02270434de31a7598e0974ab6a0cb7392..84df88de225986bb96803ffc527b63e6dd0b13a3 100644 (file)
@@ -912,9 +912,6 @@ FcPatternEltU (FcPatternEltPtr pei)
     return &_fcPatternElts[FcCacheBankToIndex(pei.bank)][pei.u.stat];
 }
 
-FcPatternElt *
-FcPatternEltU (FcPatternEltPtr pei);
-
 FcValueListPtr
 FcValueListPtrCreateDynamic(FcValueList * p);
 
index 3c902cde625e3fd685eb352ad08e39efd6091d74..c6c187adef58aaecd1a5b9dd249744c0dee5471b 100644 (file)
@@ -358,7 +358,7 @@ FcObjectDistributeBytes (FcCache * metadata, void * block_ptr)
 }
 
 void
-FcObjectSerialize ()
+FcObjectSerialize (void)
 {
     int i;
     for (i = 0; i < biggest_known_ntypes; i++)
index 5b48b11aca2e33d133da1f4921f90f848100bc4c..0ad935ef2625a48e00603858869fb4f5bfb02c6f 100644 (file)
@@ -50,6 +50,14 @@ ftglue_qalloc( FT_Memory  memory,
 
 #undef   QALLOC  /* just in case */
 #define  QALLOC(ptr,size)    ( (ptr) = ftglue_qalloc( memory, (size), &error ), error != 0 )
+#define  FREE(_ptr)                    \
+  do {                                 \
+    if ( (_ptr) )                      \
+    {                                  \
+      ftglue_free( memory, _ptr );     \
+      _ptr = NULL;                     \
+    }                                  \
+  } while (0)
 
 
 FTGLUE_APIDEF( FT_Pointer )
@@ -212,53 +220,6 @@ ftglue_stream_frame_exit( FT_Stream  stream )
 }
 
 
-FTGLUE_APIDEF( FT_Byte )
-ftglue_stream_get_byte( FT_Stream  stream )
-{
-  FT_Byte  result = 0;
-
-  if ( stream->cursor < stream->limit )
-    result = *stream->cursor++;
-
-  return result;
-}
-
-
-FTGLUE_APIDEF( FT_Short )
-ftglue_stream_get_short( FT_Stream  stream )
-{
-  FT_Byte*  p;
-  FT_Short  result = 0;
-
-  p = stream->cursor;
-  if ( p + 2 <= stream->limit )
-  {
-    result         = (FT_Short)((p[0] << 8) | p[1]);
-    stream->cursor = p+2;
-  }
-  return result;
-}
-
-
-FTGLUE_APIDEF( FT_Long )
-ftglue_stream_get_long( FT_Stream   stream )
-{
-  FT_Byte*  p;
-  FT_Long   result = 0;
-
-  p = stream->cursor;
-  if ( p + 4 <= stream->limit )
-  {
-    result         = (FT_Long)(((FT_Long)p[0] << 24) |
-                               ((FT_Long)p[1] << 16) |
-                               ((FT_Long)p[2] << 8)  |
-                                         p[3]        );
-    stream->cursor = p+4;
-  }
-  return result;
-}
-
-
 FTGLUE_APIDEF( FT_Error )
 ftglue_face_goto_table( FT_Face    face,
                         FT_ULong   the_tag,
index f526bf0a175934b58594a1216bfae500f6da7aab..93fd91efd32fffbaed88e1b7a055508d5f9e1da5 100644 (file)
@@ -71,9 +71,17 @@ FT_BEGIN_HEADER
 #define  ACCESS_Frame(size)  SET_ERR( ftglue_stream_frame_enter( stream, size ) )
 #define  FORGET_Frame()      ftglue_stream_frame_exit( stream )
 
-#define  GET_Byte()      ftglue_stream_get_byte( stream )
-#define  GET_Short()     ftglue_stream_get_short( stream )
-#define  GET_Long()      ftglue_stream_get_long( stream )
+#define  GET_Byte()      (*stream->cursor++)
+#define  GET_Short()     (stream->cursor += 2, (FT_Short)( \
+                               (*(((FT_Byte*)stream->cursor)-2) << 8) | \
+                                *(((FT_Byte*)stream->cursor)-1) \
+                        ))
+#define  GET_Long()      (stream->cursor += 4, (FT_Long)( \
+                               (*(((FT_Byte*)stream->cursor)-4) << 24) | \
+                               (*(((FT_Byte*)stream->cursor)-3) << 16) | \
+                               (*(((FT_Byte*)stream->cursor)-2) << 8) | \
+                                *(((FT_Byte*)stream->cursor)-1) \
+                        ))
 
 #define  GET_Char()      ((FT_Char)GET_Byte())
 #define  GET_UShort()    ((FT_UShort)GET_Short())
@@ -111,31 +119,6 @@ ftglue_face_goto_table( FT_Face    face,
                         FT_ULong   tag,
                         FT_Stream  stream );
 
-/* memory macros used by the OpenType parser */
-#define  ALLOC(_ptr,_size)   \
-           ( (_ptr) = ftglue_alloc( memory, _size, &error ), error != 0 )
-
-#define  REALLOC(_ptr,_oldsz,_newsz)  \
-           ( (_ptr) = ftglue_realloc( memory, (_ptr), (_oldsz), (_newsz), &error ), error != 0 )
-
-#define  FREE(_ptr)                    \
-  do {                                 \
-    if ( (_ptr) )                      \
-    {                                  \
-      ftglue_free( memory, _ptr );     \
-      _ptr = NULL;                     \
-    }                                  \
-  } while (0)
-
-#define  ALLOC_ARRAY(_ptr,_count,_type)   \
-           ALLOC(_ptr,(_count)*sizeof(_type))
-
-#define  REALLOC_ARRAY(_ptr,_oldcnt,_newcnt,_type) \
-           REALLOC(_ptr,(_oldcnt)*sizeof(_type),(_newcnt)*sizeof(_type))
-
-#define  MEM_Copy(dest,source,count)   memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
-
-
 FTGLUE_API( FT_Pointer )
 ftglue_alloc( FT_Memory  memory,
               FT_ULong   size,