ReactOS  0.4.13-dev-698-g77671f0
ftmemory.h File Reference
#include <ft2build.h>
Include dependency graph for ftmemory.h:

Go to the source code of this file.

Macros

#define FT_SET_ERROR(expression)   ( ( error = (expression) ) != 0 )
 
#define FT_ASSIGNP(p, val)   (p) = (val)
 
#define FT_DEBUG_INNER(exp)   (exp)
 
#define FT_ASSIGNP_INNER(p, exp)   FT_ASSIGNP( p, exp )
 
#define FT_MEM_ALLOC(ptr, size)
 
#define FT_MEM_FREE(ptr)
 
#define FT_MEM_NEW(ptr)   FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
 
#define FT_MEM_REALLOC(ptr, cursz, newsz)
 
#define FT_MEM_QALLOC(ptr, size)
 
#define FT_MEM_QNEW(ptr)   FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
 
#define FT_MEM_QREALLOC(ptr, cursz, newsz)
 
#define FT_MEM_ALLOC_MULT(ptr, count, item_size)
 
#define FT_MEM_REALLOC_MULT(ptr, oldcnt, newcnt, itmsz)
 
#define FT_MEM_QALLOC_MULT(ptr, count, item_size)
 
#define FT_MEM_QREALLOC_MULT(ptr, oldcnt, newcnt, itmsz)
 
#define FT_MEM_SET_ERROR(cond)   ( (cond), error != 0 )
 
#define FT_MEM_SET(dest, byte, count)   ft_memset( dest, byte, (FT_Offset)(count) )
 
#define FT_MEM_COPY(dest, source, count)   ft_memcpy( dest, source, (FT_Offset)(count) )
 
#define FT_MEM_MOVE(dest, source, count)   ft_memmove( dest, source, (FT_Offset)(count) )
 
#define FT_MEM_ZERO(dest, count)   FT_MEM_SET( dest, 0, count )
 
#define FT_ZERO(p)   FT_MEM_ZERO( p, sizeof ( *(p) ) )
 
#define FT_ARRAY_ZERO(dest, count)
 
#define FT_ARRAY_COPY(dest, source, count)
 
#define FT_ARRAY_MOVE(dest, source, count)
 
#define FT_ARRAY_MAX(ptr)   ( FT_INT_MAX / sizeof ( *(ptr) ) )
 
#define FT_ARRAY_CHECK(ptr, count)   ( (count) <= FT_ARRAY_MAX( ptr ) )
 
#define FT_MEM_NEW_ARRAY(ptr, count)
 
#define FT_MEM_RENEW_ARRAY(ptr, cursz, newsz)
 
#define FT_MEM_QNEW_ARRAY(ptr, count)
 
#define FT_MEM_QRENEW_ARRAY(ptr, cursz, newsz)
 
#define FT_ALLOC(ptr, size)   FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
 
#define FT_REALLOC(ptr, cursz, newsz)   FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )
 
#define FT_ALLOC_MULT(ptr, count, item_size)   FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )
 
#define FT_REALLOC_MULT(ptr, oldcnt, newcnt, itmsz)
 
#define FT_QALLOC(ptr, size)   FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )
 
#define FT_QREALLOC(ptr, cursz, newsz)   FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )
 
#define FT_QALLOC_MULT(ptr, count, item_size)   FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )
 
#define FT_QREALLOC_MULT(ptr, oldcnt, newcnt, itmsz)
 
#define FT_FREE(ptr)   FT_MEM_FREE( ptr )
 
#define FT_NEW(ptr)   FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )
 
#define FT_NEW_ARRAY(ptr, count)   FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
 
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)   FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
 
#define FT_QNEW(ptr)   FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )
 
#define FT_QNEW_ARRAY(ptr, count)   FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
 
#define FT_QRENEW_ARRAY(ptr, curcnt, newcnt)   FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
 
#define FT_MEM_STRDUP(dst, str)   (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
 
#define FT_STRDUP(dst, str)   FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
 
#define FT_MEM_DUP(dst, address, size)   (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
 
#define FT_DUP(dst, address, size)   FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
 
#define FT_STRCPYN(dst, src, size)   ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )
 

Functions

 ft_mem_alloc (FT_Memory memory, FT_Long size, FT_Error *p_error)
 
 ft_mem_qalloc (FT_Memory memory, FT_Long size, FT_Error *p_error)
 
 ft_mem_realloc (FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
 
 ft_mem_qrealloc (FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
 
 ft_mem_free (FT_Memory memory, const void *P)
 
 ft_mem_strdup (FT_Memory memory, const char *str, FT_Error *p_error)
 
 ft_mem_dup (FT_Memory memory, const void *address, FT_ULong size, FT_Error *p_error)
 
 ft_mem_strcpyn (char *dst, const char *src, FT_ULong size)
 

Macro Definition Documentation

◆ FT_ALLOC

#define FT_ALLOC (   ptr,
  size 
)    FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )

Definition at line 303 of file ftmemory.h.

◆ FT_ALLOC_MULT

#define FT_ALLOC_MULT (   ptr,
  count,
  item_size 
)    FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )

Definition at line 309 of file ftmemory.h.

◆ FT_ARRAY_CHECK

#define FT_ARRAY_CHECK (   ptr,
  count 
)    ( (count) <= FT_ARRAY_MAX( ptr ) )

Definition at line 262 of file ftmemory.h.

◆ FT_ARRAY_COPY

#define FT_ARRAY_COPY (   dest,
  source,
  count 
)
Value:
source, \
(FT_Offset)(count) * sizeof ( *(dest) ) )
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FT_MEM_COPY(dest, source, count)
Definition: ftmemory.h:228
static char * dest
Definition: rtl.c:135
size_t FT_Offset
Definition: fttypes.h:324

Definition at line 244 of file ftmemory.h.

◆ FT_ARRAY_MAX

#define FT_ARRAY_MAX (   ptr)    ( FT_INT_MAX / sizeof ( *(ptr) ) )

Definition at line 260 of file ftmemory.h.

◆ FT_ARRAY_MOVE

#define FT_ARRAY_MOVE (   dest,
  source,
  count 
)
Value:
source, \
(FT_Offset)(count) * sizeof ( *(dest) ) )
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char * dest
Definition: rtl.c:135
#define FT_MEM_MOVE(dest, source, count)
Definition: ftmemory.h:231
size_t FT_Offset
Definition: fttypes.h:324

Definition at line 249 of file ftmemory.h.

◆ FT_ARRAY_ZERO

#define FT_ARRAY_ZERO (   dest,
  count 
)
Value:
(FT_Offset)(count) * sizeof ( *(dest) ) )
#define FT_MEM_ZERO(dest, count)
Definition: ftmemory.h:235
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char * dest
Definition: rtl.c:135
size_t FT_Offset
Definition: fttypes.h:324

Definition at line 240 of file ftmemory.h.

◆ FT_ASSIGNP

#define FT_ASSIGNP (   p,
  val 
)    (p) = (val)

Definition at line 82 of file ftmemory.h.

◆ FT_ASSIGNP_INNER

#define FT_ASSIGNP_INNER (   p,
  exp 
)    FT_ASSIGNP( p, exp )

Definition at line 104 of file ftmemory.h.

◆ FT_DEBUG_INNER

#define FT_DEBUG_INNER (   exp)    (exp)

Definition at line 103 of file ftmemory.h.

◆ FT_DUP

#define FT_DUP (   dst,
  address,
  size 
)    FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )

Definition at line 370 of file ftmemory.h.

◆ FT_FREE

#define FT_FREE (   ptr)    FT_MEM_FREE( ptr )

Definition at line 329 of file ftmemory.h.

◆ FT_MEM_ALLOC

#define FT_MEM_ALLOC (   ptr,
  size 
)
Value:
(FT_Long)(size), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
ft_mem_alloc(FT_Memory memory, FT_Long size, FT_Error *p_error)
Definition: ftutil.c:50
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
GLsizeiptr size
Definition: glext.h:5919
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 151 of file ftmemory.h.

◆ FT_MEM_ALLOC_MULT

#define FT_MEM_ALLOC_MULT (   ptr,
  count,
  item_size 
)
Value:
(FT_Long)(item_size), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
ft_mem_realloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:92
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 189 of file ftmemory.h.

◆ FT_MEM_COPY

#define FT_MEM_COPY (   dest,
  source,
  count 
)    ft_memcpy( dest, source, (FT_Offset)(count) )

Definition at line 228 of file ftmemory.h.

◆ FT_MEM_DUP

#define FT_MEM_DUP (   dst,
  address,
  size 
)    (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )

Definition at line 367 of file ftmemory.h.

◆ FT_MEM_FREE

#define FT_MEM_FREE (   ptr)
Value:
(ptr) = NULL; \
FT_END_STMNT
ft_mem_free(FT_Memory memory, const void *P)
Definition: ftutil.c:170
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416

Definition at line 156 of file ftmemory.h.

◆ FT_MEM_MOVE

#define FT_MEM_MOVE (   dest,
  source,
  count 
)    ft_memmove( dest, source, (FT_Offset)(count) )

Definition at line 231 of file ftmemory.h.

◆ FT_MEM_NEW

#define FT_MEM_NEW (   ptr)    FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )

Definition at line 162 of file ftmemory.h.

◆ FT_MEM_NEW_ARRAY

#define FT_MEM_NEW_ARRAY (   ptr,
  count 
)
Value:
sizeof ( *(ptr) ), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
ft_mem_realloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:92
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 271 of file ftmemory.h.

◆ FT_MEM_QALLOC

#define FT_MEM_QALLOC (   ptr,
  size 
)
Value:
(FT_Long)(size), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
ft_mem_qalloc(FT_Memory memory, FT_Long size, FT_Error *p_error)
Definition: ftutil.c:66
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
GLsizeiptr size
Definition: glext.h:5919
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 173 of file ftmemory.h.

◆ FT_MEM_QALLOC_MULT

#define FT_MEM_QALLOC_MULT (   ptr,
  count,
  item_size 
)
Value:
(FT_Long)(item_size), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104
ft_mem_qrealloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:114

Definition at line 205 of file ftmemory.h.

◆ FT_MEM_QNEW

#define FT_MEM_QNEW (   ptr)    FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )

Definition at line 178 of file ftmemory.h.

◆ FT_MEM_QNEW_ARRAY

#define FT_MEM_QNEW_ARRAY (   ptr,
  count 
)
Value:
sizeof ( *(ptr) ), \
0, \
(FT_Long)(count), \
NULL, \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei count
Definition: gl.h:1545
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104
ft_mem_qrealloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:114

Definition at line 287 of file ftmemory.h.

◆ FT_MEM_QREALLOC

#define FT_MEM_QREALLOC (   ptr,
  cursz,
  newsz 
)
Value:
1, \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104
ft_mem_qrealloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:114

Definition at line 181 of file ftmemory.h.

◆ FT_MEM_QREALLOC_MULT

#define FT_MEM_QREALLOC_MULT (   ptr,
  oldcnt,
  newcnt,
  itmsz 
)
Value:
(FT_Long)(itmsz), \
(FT_Long)(oldcnt), \
(FT_Long)(newcnt), \
(ptr), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104
ft_mem_qrealloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:114

Definition at line 213 of file ftmemory.h.

◆ FT_MEM_QRENEW_ARRAY

#define FT_MEM_QRENEW_ARRAY (   ptr,
  cursz,
  newsz 
)
Value:
sizeof ( *(ptr) ), \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104
ft_mem_qrealloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:114

Definition at line 295 of file ftmemory.h.

◆ FT_MEM_REALLOC

#define FT_MEM_REALLOC (   ptr,
  cursz,
  newsz 
)
Value:
1, \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
ft_mem_realloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:92
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 165 of file ftmemory.h.

◆ FT_MEM_REALLOC_MULT

#define FT_MEM_REALLOC_MULT (   ptr,
  oldcnt,
  newcnt,
  itmsz 
)
Value:
(FT_Long)(itmsz), \
(FT_Long)(oldcnt), \
(FT_Long)(newcnt), \
(ptr), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
ft_mem_realloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:92
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 197 of file ftmemory.h.

◆ FT_MEM_RENEW_ARRAY

#define FT_MEM_RENEW_ARRAY (   ptr,
  cursz,
  newsz 
)
Value:
sizeof ( *(ptr) ), \
(FT_Long)(cursz), \
(FT_Long)(newsz), \
(ptr), \
&error ) )
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
static PVOID ptr
Definition: dispmode.c:27
ft_mem_realloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:92
#define FT_ASSIGNP_INNER(p, exp)
Definition: ftmemory.h:104

Definition at line 279 of file ftmemory.h.

◆ FT_MEM_SET

#define FT_MEM_SET (   dest,
  byte,
  count 
)    ft_memset( dest, byte, (FT_Offset)(count) )

Definition at line 225 of file ftmemory.h.

◆ FT_MEM_SET_ERROR

#define FT_MEM_SET_ERROR (   cond)    ( (cond), error != 0 )

Definition at line 222 of file ftmemory.h.

◆ FT_MEM_STRDUP

#define FT_MEM_STRDUP (   dst,
  str 
)    (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )

Definition at line 361 of file ftmemory.h.

◆ FT_MEM_ZERO

#define FT_MEM_ZERO (   dest,
  count 
)    FT_MEM_SET( dest, 0, count )

Definition at line 235 of file ftmemory.h.

◆ FT_NEW

#define FT_NEW (   ptr)    FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )

Definition at line 331 of file ftmemory.h.

◆ FT_NEW_ARRAY

#define FT_NEW_ARRAY (   ptr,
  count 
)    FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )

Definition at line 333 of file ftmemory.h.

◆ FT_QALLOC

#define FT_QALLOC (   ptr,
  size 
)    FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )

Definition at line 316 of file ftmemory.h.

◆ FT_QALLOC_MULT

#define FT_QALLOC_MULT (   ptr,
  count,
  item_size 
)    FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )

Definition at line 322 of file ftmemory.h.

◆ FT_QNEW

#define FT_QNEW (   ptr)    FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )

Definition at line 339 of file ftmemory.h.

◆ FT_QNEW_ARRAY

#define FT_QNEW_ARRAY (   ptr,
  count 
)    FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )

Definition at line 342 of file ftmemory.h.

◆ FT_QREALLOC

#define FT_QREALLOC (   ptr,
  cursz,
  newsz 
)    FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )

Definition at line 319 of file ftmemory.h.

◆ FT_QREALLOC_MULT

#define FT_QREALLOC_MULT (   ptr,
  oldcnt,
  newcnt,
  itmsz 
)
Value:
newcnt, itmsz ) )
#define FT_MEM_SET_ERROR(cond)
Definition: ftmemory.h:222
static PVOID ptr
Definition: dispmode.c:27
#define FT_MEM_QREALLOC_MULT(ptr, oldcnt, newcnt, itmsz)
Definition: ftmemory.h:213

Definition at line 325 of file ftmemory.h.

◆ FT_QRENEW_ARRAY

#define FT_QRENEW_ARRAY (   ptr,
  curcnt,
  newcnt 
)    FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )

Definition at line 345 of file ftmemory.h.

◆ FT_REALLOC

#define FT_REALLOC (   ptr,
  cursz,
  newsz 
)    FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )

Definition at line 306 of file ftmemory.h.

◆ FT_REALLOC_MULT

#define FT_REALLOC_MULT (   ptr,
  oldcnt,
  newcnt,
  itmsz 
)
Value:
newcnt, itmsz ) )
#define FT_MEM_SET_ERROR(cond)
Definition: ftmemory.h:222
static PVOID ptr
Definition: dispmode.c:27
#define FT_MEM_REALLOC_MULT(ptr, oldcnt, newcnt, itmsz)
Definition: ftmemory.h:197

Definition at line 312 of file ftmemory.h.

◆ FT_RENEW_ARRAY

#define FT_RENEW_ARRAY (   ptr,
  curcnt,
  newcnt 
)    FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )

Definition at line 336 of file ftmemory.h.

◆ FT_SET_ERROR

#define FT_SET_ERROR (   expression)    ( ( error = (expression) ) != 0 )

Definition at line 42 of file ftmemory.h.

◆ FT_STRCPYN

#define FT_STRCPYN (   dst,
  src,
  size 
)    ft_mem_strcpyn( (char*)dst, (const char*)(src), (FT_ULong)(size) )

Definition at line 382 of file ftmemory.h.

◆ FT_STRDUP

#define FT_STRDUP (   dst,
  str 
)    FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )

Definition at line 364 of file ftmemory.h.

◆ FT_ZERO

#define FT_ZERO (   p)    FT_MEM_ZERO( p, sizeof ( *(p) ) )

Definition at line 237 of file ftmemory.h.

Function Documentation

◆ ft_mem_alloc()

ft_mem_alloc ( FT_Memory  memory,
FT_Long  size,
FT_Error p_error 
)

Definition at line 50 of file ftutil.c.

53  {
56 
57  if ( !error && size > 0 )
59 
60  *p_error = error;
61  return block;
62  }
static unsigned int block
Definition: xmlmemory.c:118
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
#define FT_MEM_ZERO(dest, count)
Definition: ftmemory.h:235
ft_mem_qalloc(FT_Memory memory, FT_Long size, FT_Error *p_error)
Definition: ftutil.c:66
static char memory[1024 *256]
Definition: process.c:116
GLsizeiptr size
Definition: glext.h:5919

◆ ft_mem_dup()

ft_mem_dup ( FT_Memory  memory,
const void address,
FT_ULong  size,
FT_Error p_error 
)

Definition at line 179 of file ftutil.c.

183  {
184  FT_Error error;
186 
187 
188  if ( !error && address )
189  ft_memcpy( p, address, size );
190 
191  *p_error = error;
192  return p;
193  }
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
ft_mem_qalloc(FT_Memory memory, FT_Long size, FT_Error *p_error)
Definition: ftutil.c:66
static char memory[1024 *256]
Definition: process.c:116
GLsizeiptr size
Definition: glext.h:5919
GLuint address
Definition: glext.h:9393
GLfloat GLfloat p
Definition: glext.h:8902
#define ft_memcpy
Definition: ftstdlib.h:82

Referenced by ft_mem_strdup().

◆ ft_mem_free()

ft_mem_free ( FT_Memory  memory,
const void P 
)

Definition at line 170 of file ftutil.c.

172  {
173  if ( P )
174  memory->free( memory, (void*)P );
175  }
static char memory[1024 *256]
Definition: process.c:116
#define P(row, col)

Referenced by ft_mem_qrealloc(), FT_Stream_ExitFrame(), and FT_Stream_ReleaseFrame().

◆ ft_mem_qalloc()

ft_mem_qalloc ( FT_Memory  memory,
FT_Long  size,
FT_Error p_error 
)

Definition at line 66 of file ftutil.c.

69  {
72 
73 
74  if ( size > 0 )
75  {
76  block = memory->alloc( memory, size );
77  if ( !block )
78  error = FT_THROW( Out_Of_Memory );
79  }
80  else if ( size < 0 )
81  {
82  /* may help catch/prevent security issues */
83  error = FT_THROW( Invalid_Argument );
84  }
85 
86  *p_error = error;
87  return block;
88  }
static unsigned int block
Definition: xmlmemory.c:118
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
#define FT_THROW(e)
Definition: ftdebug.h:213
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919

Referenced by ft_mem_alloc(), ft_mem_dup(), and FT_Stream_EnterFrame().

◆ ft_mem_qrealloc()

ft_mem_qrealloc ( FT_Memory  memory,
FT_Long  item_size,
FT_Long  cur_count,
FT_Long  new_count,
void block,
FT_Error p_error 
)

Definition at line 114 of file ftutil.c.

120  {
122 
123 
124  /* Note that we now accept `item_size == 0' as a valid parameter, in
125  * order to cover very weird cases where an ALLOC_MULT macro would be
126  * called.
127  */
128  if ( cur_count < 0 || new_count < 0 || item_size < 0 )
129  {
130  /* may help catch/prevent nasty security issues */
131  error = FT_THROW( Invalid_Argument );
132  }
133  else if ( new_count == 0 || item_size == 0 )
134  {
136  block = NULL;
137  }
138  else if ( new_count > FT_INT_MAX / item_size )
139  {
140  error = FT_THROW( Array_Too_Large );
141  }
142  else if ( cur_count == 0 )
143  {
144  FT_ASSERT( !block );
145 
146  block = memory->alloc( memory, new_count * item_size );
147  if ( block == NULL )
148  error = FT_THROW( Out_Of_Memory );
149  }
150  else
151  {
153  FT_Long cur_size = cur_count * item_size;
154  FT_Long new_size = new_count * item_size;
155 
156 
157  block2 = memory->realloc( memory, cur_size, new_size, block );
158  if ( !block2 )
159  error = FT_THROW( Out_Of_Memory );
160  else
161  block = block2;
162  }
163 
164  *p_error = error;
165  return block;
166  }
static unsigned int block
Definition: xmlmemory.c:118
int FT_Error
Definition: fttypes.h:300
signed long FT_Long
Definition: fttypes.h:242
#define error(str)
Definition: mkdosfs.c:1605
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
static const struct metadata_block block2[]
Definition: metadata.c:2838
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FT_THROW(e)
Definition: ftdebug.h:213
smooth NULL
Definition: ftsmooth.c:416
ft_mem_free(FT_Memory memory, const void *P)
Definition: ftutil.c:170
#define FT_INT_MAX
Definition: ftstdlib.h:63

Referenced by ft_mem_realloc().

◆ ft_mem_realloc()

ft_mem_realloc ( FT_Memory  memory,
FT_Long  item_size,
FT_Long  cur_count,
FT_Long  new_count,
void block,
FT_Error p_error 
)

Definition at line 92 of file ftutil.c.

98  {
100 
101 
102  block = ft_mem_qrealloc( memory, item_size,
103  cur_count, new_count, block, &error );
104  if ( !error && new_count > cur_count )
105  FT_MEM_ZERO( (char*)block + cur_count * item_size,
106  ( new_count - cur_count ) * item_size );
107 
108  *p_error = error;
109  return block;
110  }
static unsigned int block
Definition: xmlmemory.c:118
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
#define FT_MEM_ZERO(dest, count)
Definition: ftmemory.h:235
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
ft_mem_qrealloc(FT_Memory memory, FT_Long item_size, FT_Long cur_count, FT_Long new_count, void *block, FT_Error *p_error)
Definition: ftutil.c:114

◆ ft_mem_strcpyn()

ft_mem_strcpyn ( char dst,
const char src,
FT_ULong  size 
)

Definition at line 210 of file ftutil.c.

213  {
214  while ( size > 1 && *src != 0 )
215  {
216  *dst++ = *src++;
217  size--;
218  }
219 
220  *dst = 0; /* always zero-terminate */
221 
222  return *src != 0;
223  }
GLsizeiptr size
Definition: glext.h:5919
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

◆ ft_mem_strdup()

ft_mem_strdup ( FT_Memory  memory,
const char str,
FT_Error p_error 
)

Definition at line 197 of file ftutil.c.

200  {
201  FT_ULong len = str ? (FT_ULong)ft_strlen( str ) + 1
202  : 0;
203 
204 
205  return ft_mem_dup( memory, str, len, p_error );
206  }
unsigned long FT_ULong
Definition: fttypes.h:253
static char memory[1024 *256]
Definition: process.c:116
const WCHAR * str
ft_mem_dup(FT_Memory memory, const void *address, FT_ULong size, FT_Error *p_error)
Definition: ftutil.c:179
GLenum GLsizei len
Definition: glext.h:6722
#define ft_strlen
Definition: ftstdlib.h:88