freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] [graph] Avoid unnecessary memory


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [graph] Avoid unnecessary memory zeroing.
Date: Fri, 22 Oct 2021 02:41:03 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

2 changed files:

Changes:

  • graph/grblit.c
    ... ... @@ -10,6 +10,7 @@
    10 10
     /****************************************************************************/
    
    11 11
     
    
    12 12
     #include "grblit.h"
    
    13
    +#include <string.h>
    
    13 14
     
    
    14 15
     #define  GRAY8
    
    15 16
     
    
    ... ... @@ -553,7 +554,7 @@
    553 554
           int    i;
    
    554 555
           byte*  table;
    
    555 556
     
    
    556
    -      table = grAlloc( (size_t)( 3 * num_grays - 1 ) * sizeof ( byte ) );
    
    557
    +      table = (byte*)malloc( (size_t)( 3 * num_grays - 1 ) * sizeof ( byte ) );
    
    557 558
           if (!table)
    
    558 559
             return NULL;
    
    559 560
     
    
    ... ... @@ -563,8 +564,7 @@
    563 564
           for ( i = 0; i < num_grays; i++, table++ )
    
    564 565
             *table = (byte)i;
    
    565 566
     
    
    566
    -      for ( i = 2*num_grays-1; i > 0; i--, table++ )
    
    567
    -        *table = (byte)(num_grays-1);
    
    567
    +      memset( table, num_grays-1, 2*num_grays-1 );
    
    568 568
     
    
    569 569
           gr_num_saturations++;
    
    570 570
           gr_last_saturation = sat;
    
    ... ... @@ -651,7 +651,7 @@
    651 651
           byte*  table;
    
    652 652
           int    n;
    
    653 653
     
    
    654
    -      table = grAlloc( (size_t)source_grays * sizeof ( byte ) );
    
    654
    +      table = (byte*)malloc( (size_t)source_grays * sizeof ( byte ) );
    
    655 655
           if (!table)
    
    656 656
             return NULL;
    
    657 657
     
    

  • graph/x11/grx11.c
    ... ... @@ -39,7 +39,6 @@
    39 39
     #ifdef TEST
    
    40 40
     #include <ctype.h>
    
    41 41
     #define LOG(x)  printf x
    
    42
    -#define grAlloc  malloc
    
    43 42
     #else
    
    44 43
     #define LOG(x)  /* nothing */
    
    45 44
     #endif
    
    ... ... @@ -1388,7 +1387,7 @@
    1388 1387
         /* Allocate or link surface image data */
    
    1389 1388
         if ( surface->convert )
    
    1390 1389
         {
    
    1391
    -      surface->ximage->data = (char*)grAlloc( (size_t)bitmap->rows *
    
    1390
    +      surface->ximage->data = (char*)malloc( (size_t)bitmap->rows *
    
    1392 1391
                                   (size_t)surface->ximage->bytes_per_line );
    
    1393 1392
           if ( !surface->ximage->data )
    
    1394 1393
             return 0;
    


  • reply via email to

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