freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][master] [builds/windows] Use native memory allo


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [builds/windows] Use native memory allocation API.
Date: Tue, 07 Sep 2021 21:08:14 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • builds/windows/ftsystem.c
    ... ... @@ -25,11 +25,10 @@
    25 25
     #include <freetype/fttypes.h>
    
    26 26
     #include <freetype/internal/ftstream.h>
    
    27 27
     
    
    28
    -  /* memory-mapping includes and definitions */
    
    28
    +  /* memory mapping and allocation includes and definitions */
    
    29
    +#define WIN32_LEAN_AND_MEAN
    
    29 30
     #include <windows.h>
    
    30 31
     
    
    31
    -#include <stdlib.h>
    
    32
    -
    
    33 32
     
    
    34 33
       /**************************************************************************
    
    35 34
        *
    
    ... ... @@ -69,9 +68,7 @@
    69 68
       ft_alloc( FT_Memory  memory,
    
    70 69
                 long       size )
    
    71 70
       {
    
    72
    -    FT_UNUSED( memory );
    
    73
    -
    
    74
    -    return malloc( size );
    
    71
    +    return HeapAlloc( memory->user, 0, size );
    
    75 72
       }
    
    76 73
     
    
    77 74
     
    
    ... ... @@ -105,10 +102,9 @@
    105 102
                   long       new_size,
    
    106 103
                   void*      block )
    
    107 104
       {
    
    108
    -    FT_UNUSED( memory );
    
    109 105
         FT_UNUSED( cur_size );
    
    110 106
     
    
    111
    -    return realloc( block, new_size );
    
    107
    +    return HeapReAlloc( memory->user, 0, block, new_size );
    
    112 108
       }
    
    113 109
     
    
    114 110
     
    
    ... ... @@ -131,9 +127,7 @@
    131 127
       ft_free( FT_Memory  memory,
    
    132 128
                void*      block )
    
    133 129
       {
    
    134
    -    FT_UNUSED( memory );
    
    135
    -
    
    136
    -    free( block );
    
    130
    +    HeapFree( memory->user, 0, block );
    
    137 131
       }
    
    138 132
     
    
    139 133
     
    
    ... ... @@ -357,13 +351,17 @@
    357 351
       FT_BASE_DEF( FT_Memory )
    
    358 352
       FT_New_Memory( void )
    
    359 353
       {
    
    354
    +    HANDLE     heap;
    
    360 355
         FT_Memory  memory;
    
    361 356
     
    
    362 357
     
    
    363
    -    memory = (FT_Memory)malloc( sizeof ( *memory ) );
    
    358
    +    heap   = GetProcessHeap();
    
    359
    +    memory = heap ? (FT_Memory)HeapAlloc( heap, 0, sizeof ( *memory ) )
    
    360
    +                  : NULL;
    
    361
    +
    
    364 362
         if ( memory )
    
    365 363
         {
    
    366
    -      memory->user    = NULL;
    
    364
    +      memory->user    = heap;
    
    367 365
           memory->alloc   = ft_alloc;
    
    368 366
           memory->realloc = ft_realloc;
    
    369 367
           memory->free    = ft_free;
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]