misc/libfreetype/include/freetype/internal/ftmemory.h
author koda
Mon, 25 Apr 2011 01:46:54 +0200
changeset 5172 88f2e05288ba
permissions -rw-r--r--
aaand let's add freetype as well while we are at it other smaller changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  ftmemory.h                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    The FreeType memory management macros (specification).               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#ifndef __FTMEMORY_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#define __FTMEMORY_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include FT_CONFIG_CONFIG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#include FT_TYPES_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  /* <Macro>                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  /*    FT_SET_ERROR                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  /* <Description>                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  /*    This macro is used to set an implicit `error' variable to a given  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  /*    expression's value (usually a function call), and convert it to a  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /*    boolean which is set whenever the value is != 0.                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
#undef  FT_SET_ERROR
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
#define FT_SET_ERROR( expression ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
          ( ( error = (expression) ) != 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  /****                           M E M O R Y                           ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
  /****                                                                 ****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
   *  C++ refuses to handle statements like p = (void*)anything, with `p' a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
   *  typed pointer.  Since we don't have a `typeof' operator in standard
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
   *  C++, we have to use a template to emulate it.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
#ifdef __cplusplus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
  extern "C++"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  template <typename T> inline T*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
  cplusplus_typeof(        T*,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
                    void  *v )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    return static_cast <T*> ( v );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
#define FT_ASSIGNP( p, val )  (p) = cplusplus_typeof( (p), (val) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
#define FT_ASSIGNP( p, val )  (p) = (val)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
#ifdef FT_DEBUG_MEMORY
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
  FT_BASE( const char* )  _ft_debug_file;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  FT_BASE( long )         _ft_debug_lineno;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
#define FT_DEBUG_INNER( exp )  ( _ft_debug_file   = __FILE__, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
                                 _ft_debug_lineno = __LINE__, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
                                 (exp) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
#define FT_ASSIGNP_INNER( p, exp )  ( _ft_debug_file   = __FILE__, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
                                      _ft_debug_lineno = __LINE__, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
                                      FT_ASSIGNP( p, exp ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
#else /* !FT_DEBUG_MEMORY */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
#define FT_DEBUG_INNER( exp )       (exp)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
#define FT_ASSIGNP_INNER( p, exp )  FT_ASSIGNP( p, exp )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
#endif /* !FT_DEBUG_MEMORY */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
   *  The allocation functions return a pointer, and the error code
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
   *  is written to through the `p_error' parameter.  See below for
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
   *  for documentation.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
  ft_mem_alloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
                FT_Long    size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
                FT_Error  *p_error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
  ft_mem_qalloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
                 FT_Long    size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
                 FT_Error  *p_error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
  ft_mem_realloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
                  FT_Long    item_size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
                  FT_Long    cur_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
                  FT_Long    new_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
                  void*      block,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
                  FT_Error  *p_error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
  ft_mem_qrealloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
                   FT_Long    item_size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
                   FT_Long    cur_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
                   FT_Long    new_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
                   void*      block,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
                   FT_Error  *p_error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
  ft_mem_free( FT_Memory    memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
               const void*  P );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
#define FT_MEM_ALLOC( ptr, size )                                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
          FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
#define FT_MEM_FREE( ptr )                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
          FT_BEGIN_STMNT                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
            ft_mem_free( memory, (ptr) ); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
            (ptr) = NULL;                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
          FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
#define FT_MEM_NEW( ptr )                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
          FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
#define FT_MEM_REALLOC( ptr, cursz, newsz )                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1,        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
                                                 (cursz), (newsz), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
                                                 (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
#define FT_MEM_QALLOC( ptr, size )                                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
          FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
#define FT_MEM_QNEW( ptr )                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
          FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
#define FT_MEM_QREALLOC( ptr, cursz, newsz )                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1,        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
                                                  (cursz), (newsz), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
                                                  (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz )                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
                                                  (cursz), (newsz),          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
                                                  (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
#define FT_MEM_ALLOC_MULT( ptr, count, item_size )                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
                                                 0, (count),          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
                                                 NULL, &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz )            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz),    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
                                                 (oldcnt), (newcnt), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
                                                 (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
#define FT_MEM_QALLOC_MULT( ptr, count, item_size )                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
                                                  0, (count),          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
                                                  NULL, &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz)             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz),    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
                                                  (oldcnt), (newcnt), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
                                                  (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
#define FT_MEM_SET_ERROR( cond )  ( (cond), error != 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
#define FT_MEM_SET( dest, byte, count )     ft_memset( dest, byte, count )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
#define FT_MEM_COPY( dest, source, count )  ft_memcpy( dest, source, count )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
#define FT_MEM_MOVE( dest, source, count )  ft_memmove( dest, source, count )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
#define FT_ZERO( p )                FT_MEM_ZERO( p, sizeof ( *(p) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
#define FT_ARRAY_ZERO( dest, count )                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
          FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
#define FT_ARRAY_COPY( dest, source, count )                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
          FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
#define FT_ARRAY_MOVE( dest, source, count )                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
          FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
   *  Return the maximum number of addressable elements in an array.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
   *  We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
   *  any problems.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
#define FT_ARRAY_MAX( ptr )           ( FT_INT_MAX / sizeof ( *(ptr) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
#define FT_ARRAY_CHECK( ptr, count )  ( (count) <= FT_ARRAY_MAX( ptr ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
  /* The following functions macros expect that their pointer argument is  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  /* _typed_ in order to automatically compute array element sizes.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
#define FT_MEM_NEW_ARRAY( ptr, count )                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
                                                 0, (count),                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
                                                 NULL, &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz )                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
          FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
                                                 (cursz), (newsz),          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
                                                 (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
#define FT_MEM_QNEW_ARRAY( ptr, count )                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
                                                  0, (count),                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
                                                  NULL, &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz )                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
          FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
                                                  (cursz), (newsz),          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
                                                  (ptr), &error ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
#define FT_ALLOC( ptr, size )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
          FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
#define FT_REALLOC( ptr, cursz, newsz )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
          FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
#define FT_ALLOC_MULT( ptr, count, item_size )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
          FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz )              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
          FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt,      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
                                                 newcnt, itmsz ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
#define FT_QALLOC( ptr, size )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
          FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
#define FT_QREALLOC( ptr, cursz, newsz )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
          FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
#define FT_QALLOC_MULT( ptr, count, item_size )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
          FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz )              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
          FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt,      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
                                                  newcnt, itmsz ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
#define FT_FREE( ptr )  FT_MEM_FREE( ptr )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
#define FT_NEW( ptr )  FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
#define FT_NEW_ARRAY( ptr, count )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
          FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
#define FT_RENEW_ARRAY( ptr, curcnt, newcnt )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
          FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
#define FT_QNEW( ptr )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
          FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
#define FT_QNEW_ARRAY( ptr, count )                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
          FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt )                          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
          FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
  FT_Alloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
            FT_Long    size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
            void*     *P );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
  FT_QAlloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
             FT_Long    size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
             void*     *p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
  FT_Realloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
              FT_Long    current,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
              FT_Long    size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
              void*     *P );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
  FT_BASE( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
  FT_QRealloc( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
               FT_Long    current,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
               FT_Long    size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
               void*     *p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
  FT_BASE( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
  FT_Free( FT_Memory  memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
           void*     *P );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
  ft_mem_strdup( FT_Memory    memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
                 const char*  str,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
                 FT_Error    *p_error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
  FT_BASE( FT_Pointer )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
  ft_mem_dup( FT_Memory    memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
              const void*  address,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
              FT_ULong     size,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
              FT_Error    *p_error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
#define FT_MEM_STRDUP( dst, str )                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
          (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
#define FT_STRDUP( dst, str )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
          FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
#define FT_MEM_DUP( dst, address, size )                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
          (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
#define FT_DUP( dst, address, size )                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
          FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
  /* Return >= 1 if a truncation occurs.            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
  /* Return 0 if the source string fits the buffer. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
  /* This is *not* the same as strlcpy().           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
  FT_BASE( FT_Int )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
  ft_mem_strcpyn( char*        dst,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
                  const char*  src,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
                  FT_ULong     size );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
#define FT_STRCPYN( dst, src, size )                                         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
          ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
 /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
#endif /* __FTMEMORY_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
/* END */