2000-07-20 08:57:41 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftsystem.c */
|
|
|
|
/* */
|
|
|
|
/* Unix-specific FreeType low-level system interface (body). */
|
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
/* Copyright 1996-2001 by */
|
2000-07-20 08:57:41 +02:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
#include <ft2build.h>
|
2001-06-28 09:17:51 +02:00
|
|
|
/* we use our special ftconfig.h file, not the standard one */
|
2000-12-13 10:21:59 +01:00
|
|
|
#include <ftconfig.h>
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_SYSTEM_H
|
|
|
|
#include FT_ERRORS_H
|
2000-12-13 10:21:59 +01:00
|
|
|
#include FT_TYPES_H
|
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
2000-07-08 02:22:20 +02:00
|
|
|
|
2000-08-01 00:51:00 +02:00
|
|
|
/* memory-mapping includes and definitions */
|
2000-07-08 02:22:20 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#ifndef MAP_FILE
|
|
|
|
#define MAP_FILE 0x00
|
|
|
|
#endif
|
|
|
|
|
2000-08-01 00:51:00 +02:00
|
|
|
#ifdef MUNMAP_USES_VOIDP
|
|
|
|
#define MUNMAP_ARG_CAST void *
|
|
|
|
#else
|
|
|
|
#define MUNMAP_ARG_CAST char *
|
2000-07-08 02:22:20 +02:00
|
|
|
#endif
|
|
|
|
|
2000-08-01 00:51:00 +02:00
|
|
|
#ifdef NEED_MUNMAP_DECL
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
#else
|
|
|
|
extern
|
|
|
|
#endif
|
2001-06-28 09:17:51 +02:00
|
|
|
int
|
|
|
|
munmap( char* addr,
|
|
|
|
int len );
|
2000-08-01 00:51:00 +02:00
|
|
|
|
|
|
|
#define MUNMAP_ARG_CAST char *
|
|
|
|
|
|
|
|
#endif /* NEED_DECLARATION_MUNMAP */
|
|
|
|
|
|
|
|
|
2000-12-13 10:21:59 +01:00
|
|
|
#include <sys/types.h>
|
2000-07-08 02:22:20 +02:00
|
|
|
#include <sys/stat.h>
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
#ifdef HAVE_FCNTL_H
|
|
|
|
#include <fcntl.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* MEMORY MANAGEMENT INTERFACE */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* ft_alloc */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* The memory allocation function. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* memory :: A pointer to the memory object. */
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
/* */
|
2000-07-20 08:57:41 +02:00
|
|
|
/* size :: The requested size in bytes. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
/* The address of newly allocated block. */
|
2000-07-20 08:57:41 +02:00
|
|
|
/* */
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( void* )
|
2001-06-27 11:26:46 +02:00
|
|
|
ft_alloc( FT_Memory memory,
|
|
|
|
long size )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_UNUSED( memory );
|
2000-07-08 02:22:20 +02:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
return malloc( size );
|
|
|
|
}
|
2000-07-08 02:22:20 +02:00
|
|
|
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* ft_realloc */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* The memory reallocation function. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* memory :: A pointer to the memory object. */
|
|
|
|
/* */
|
|
|
|
/* cur_size :: The current size of the allocated memory block. */
|
|
|
|
/* */
|
|
|
|
/* new_size :: The newly requested size in bytes. */
|
|
|
|
/* */
|
|
|
|
/* block :: The current address of the block in memory. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* The address of the reallocated memory block. */
|
|
|
|
/* */
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( void* )
|
2001-06-27 11:26:46 +02:00
|
|
|
ft_realloc( FT_Memory memory,
|
|
|
|
long cur_size,
|
|
|
|
long new_size,
|
|
|
|
void* block )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_UNUSED( memory );
|
|
|
|
FT_UNUSED( cur_size );
|
2000-07-08 02:22:20 +02:00
|
|
|
|
|
|
|
return realloc( block, new_size );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* ft_free */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* The memory release function. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* memory :: A pointer to the memory object. */
|
|
|
|
/* */
|
|
|
|
/* block :: The address of block in memory to be freed. */
|
|
|
|
/* */
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( void )
|
2001-06-27 11:26:46 +02:00
|
|
|
ft_free( FT_Memory memory,
|
|
|
|
void* block )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_UNUSED( memory );
|
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
free( block );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* RESOURCE MANAGEMENT INTERFACE */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
2000-07-08 02:22:20 +02:00
|
|
|
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
2000-07-08 02:22:20 +02:00
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_io
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
/* We use the macro STREAM_FILE for convenience to extract the */
|
|
|
|
/* system-specific stream handle from a given FreeType stream object */
|
|
|
|
#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* ft_close_stream */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* The function to close a stream. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* stream :: A pointer to the stream object. */
|
|
|
|
/* */
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( void )
|
2001-06-27 11:26:46 +02:00
|
|
|
ft_close_stream( FT_Stream stream )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
2000-08-01 00:51:00 +02:00
|
|
|
munmap( (MUNMAP_ARG_CAST)stream->descriptor.pointer, stream->size );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
stream->descriptor.pointer = NULL;
|
|
|
|
stream->size = 0;
|
|
|
|
stream->base = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
/* documentation is in ftobjs.h */
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_New_Stream( const char* filepathname,
|
|
|
|
FT_Stream stream )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
|
|
|
int file;
|
|
|
|
struct stat stat_buf;
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
if ( !stream )
|
|
|
|
return FT_Err_Invalid_Stream_Handle;
|
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
/* open the file */
|
|
|
|
file = open( filepathname, O_RDONLY );
|
2000-07-20 08:57:41 +02:00
|
|
|
if ( file < 0 )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_ERROR(( "FT_New_Stream:" ));
|
2000-07-08 02:22:20 +02:00
|
|
|
FT_ERROR(( " could not open `%s'\n", filepathname ));
|
2000-07-20 08:57:41 +02:00
|
|
|
return FT_Err_Cannot_Open_Resource;
|
2000-07-08 02:22:20 +02:00
|
|
|
}
|
|
|
|
|
2002-01-03 23:06:13 +01:00
|
|
|
/* Here we ensure that a "fork" will _not_ duplicate */
|
|
|
|
/* our opened input streams on Unix. This is critical */
|
|
|
|
/* since it avoids some (possible) access control */
|
|
|
|
/* issues and cleans up the kernel file table a bit. */
|
2002-01-03 18:08:20 +01:00
|
|
|
/* */
|
|
|
|
#ifdef F_SETFD
|
2002-01-03 23:06:13 +01:00
|
|
|
#ifdef FD_CLOEXEC
|
|
|
|
ret = fcntl( file, F_SETFD, FD_CLOEXEC );
|
|
|
|
#else
|
|
|
|
ret = fcntl( file, F_SETFD, 1 );
|
|
|
|
#endif /* FD_CLOEXEC */
|
2002-01-03 18:08:20 +01:00
|
|
|
#endif /* F_SETFD */
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
if ( fstat( file, &stat_buf ) < 0 )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_ERROR(( "FT_New_Stream:" ));
|
2000-07-08 02:22:20 +02:00
|
|
|
FT_ERROR(( " could not `fstat' file `%s'\n", filepathname ));
|
|
|
|
goto Fail_Map;
|
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
stream->size = stat_buf.st_size;
|
|
|
|
stream->pos = 0;
|
2000-08-01 00:51:00 +02:00
|
|
|
stream->base = (unsigned char *)mmap( NULL,
|
|
|
|
stream->size,
|
|
|
|
PROT_READ,
|
|
|
|
MAP_FILE | MAP_PRIVATE,
|
|
|
|
file,
|
|
|
|
0 );
|
2000-07-08 02:22:20 +02:00
|
|
|
|
|
|
|
if ( (long)stream->base == -1 )
|
|
|
|
{
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_ERROR(( "FT_New_Stream:" ));
|
|
|
|
FT_ERROR(( " could not `mmap' file `%s'\n", filepathname ));
|
2000-07-08 02:22:20 +02:00
|
|
|
goto Fail_Map;
|
|
|
|
}
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
close( file );
|
2000-07-08 02:22:20 +02:00
|
|
|
|
|
|
|
stream->descriptor.pointer = stream->base;
|
|
|
|
stream->pathname.pointer = (char*)filepathname;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
stream->close = ft_close_stream;
|
|
|
|
stream->read = 0;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
FT_TRACE1(( "FT_New_Stream:" ));
|
2000-07-08 02:22:20 +02:00
|
|
|
FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
|
|
|
|
filepathname, stream->size ));
|
|
|
|
|
|
|
|
return FT_Err_Ok;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
Fail_Map:
|
2000-07-20 08:57:41 +02:00
|
|
|
close( file );
|
|
|
|
|
|
|
|
stream->base = NULL;
|
|
|
|
stream->size = 0;
|
|
|
|
stream->pos = 0;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
return FT_Err_Cannot_Open_Stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-24 09:32:55 +02:00
|
|
|
#ifdef FT_DEBUG_MEMORY
|
|
|
|
|
|
|
|
extern FT_Int
|
|
|
|
ft_mem_debug_init( FT_Memory memory );
|
|
|
|
|
|
|
|
extern void
|
|
|
|
ft_mem_debug_done( FT_Memory memory );
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
/* documentation is in ftobjs.h */
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( FT_Memory )
|
|
|
|
FT_New_Memory( void )
|
2000-07-08 02:22:20 +02:00
|
|
|
{
|
|
|
|
FT_Memory memory;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
memory = (FT_Memory)malloc( sizeof ( *memory ) );
|
|
|
|
if ( memory )
|
2001-10-24 16:43:40 +02:00
|
|
|
{
|
2000-07-08 02:22:20 +02:00
|
|
|
memory->user = 0;
|
|
|
|
memory->alloc = ft_alloc;
|
|
|
|
memory->realloc = ft_realloc;
|
|
|
|
memory->free = ft_free;
|
2001-10-24 09:32:55 +02:00
|
|
|
#ifdef FT_DEBUG_MEMORY
|
|
|
|
ft_mem_debug_init( memory );
|
|
|
|
#endif
|
2000-07-08 02:22:20 +02:00
|
|
|
}
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2000-07-08 02:22:20 +02:00
|
|
|
return memory;
|
|
|
|
}
|
|
|
|
|
2000-07-28 01:29:08 +02:00
|
|
|
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
/* documentation is in ftobjs.h */
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FT_Done_Memory( FT_Memory memory )
|
2000-07-27 23:40:22 +02:00
|
|
|
{
|
2001-10-24 09:32:55 +02:00
|
|
|
#ifdef FT_DEBUG_MEMORY
|
|
|
|
ft_mem_debug_done( memory );
|
|
|
|
#endif
|
* include/freetype/config/ft2build.h (FT2_ROOT, FT2_CONFIG_ROOT):
Removed. ANSI C doesn't (explicitly) allow macro expansion in
arguments using `##'.
(FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE): Use directory
names directly. Make them configurable. Use `##' to strip leading
and trailing spaces from arguments.
* builds/unix/ft2unix.h: Adapted.
* src/base/ftsystem.c (ft_alloc, ft_realloc, ft_free, ft_io_stream,
ft_close_stream): Use FT_CALLBACK_DEF.
* builds/unix/ftsystem.c: Use new header scheme.
(FT_Done_Memory): Use free() from FT_Memory structure.
* src/base/ftinit.c, src/base/ftmac.c: Header scheme fixes.
* include/freetype/config/ft2build.h (FT2_CONFIG_ROOT,
FT2_PUBLIC_FILE, FT2_CONFIG_FILE, FT2_INTERNAL_FILE,
FT_SOURCE_FILE): Use `##' operator to be really ANSI C compliant.
2000-12-12 23:28:12 +01:00
|
|
|
memory->free( memory, memory );
|
2000-07-27 23:40:22 +02:00
|
|
|
}
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
/* END */
|