freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 4 commits: [cache, psaux] Remove zeros.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 4 commits: [cache, psaux] Remove zeros.
Date: Mon, 13 Sep 2021 04:13:49 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

6 changed files:

Changes:

  • src/base/ftobjs.c
    ... ... @@ -2610,7 +2610,7 @@
    2610 2610
         FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" ));
    
    2611 2611
     
    
    2612 2612
         /* add the face object to its driver's list */
    
    2613
    -    if ( FT_NEW( node ) )
    
    2613
    +    if ( FT_QNEW( node ) )
    
    2614 2614
           goto Fail;
    
    2615 2615
     
    
    2616 2616
         node->data = face;
    
    ... ... @@ -2895,7 +2895,7 @@
    2895 2895
         memory = face->memory;
    
    2896 2896
     
    
    2897 2897
         /* Allocate new size object and perform basic initialisation */
    
    2898
    -    if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) )
    
    2898
    +    if ( FT_ALLOC( size, clazz->size_object_size ) || FT_QNEW( node ) )
    
    2899 2899
           goto Exit;
    
    2900 2900
     
    
    2901 2901
         size->face = face;
    
    ... ... @@ -3707,9 +3707,9 @@
    3707 3707
               FT_CharMap  last_charmap = face->charmaps[face->num_charmaps - 1];
    
    3708 3708
     
    
    3709 3709
     
    
    3710
    -          if ( FT_RENEW_ARRAY( face->charmaps,
    
    3711
    -                               face->num_charmaps,
    
    3712
    -                               face->num_charmaps - 1 ) )
    
    3710
    +          if ( FT_QRENEW_ARRAY( face->charmaps,
    
    3711
    +                                face->num_charmaps,
    
    3712
    +                                face->num_charmaps - 1 ) )
    
    3713 3713
                 return;
    
    3714 3714
     
    
    3715 3715
               /* remove it from our list of charmaps */
    
    ... ... @@ -3741,10 +3741,10 @@
    3741 3741
                    FT_CharMap     charmap,
    
    3742 3742
                    FT_CMap       *acmap )
    
    3743 3743
       {
    
    3744
    -    FT_Error   error = FT_Err_Ok;
    
    3744
    +    FT_Error   error;
    
    3745 3745
         FT_Face    face;
    
    3746 3746
         FT_Memory  memory;
    
    3747
    -    FT_CMap    cmap = NULL;
    
    3747
    +    FT_CMap    cmap;
    
    3748 3748
     
    
    3749 3749
     
    
    3750 3750
         if ( !clazz || !charmap || !charmap->face )
    
    ... ... @@ -3753,7 +3753,7 @@
    3753 3753
         face   = charmap->face;
    
    3754 3754
         memory = FT_FACE_MEMORY( face );
    
    3755 3755
     
    
    3756
    -    if ( !FT_ALLOC( cmap, clazz->size ) )
    
    3756
    +    if ( !FT_QALLOC( cmap, clazz->size ) )
    
    3757 3757
         {
    
    3758 3758
           cmap->charmap = *charmap;
    
    3759 3759
           cmap->clazz   = clazz;
    
    ... ... @@ -3766,9 +3766,9 @@
    3766 3766
           }
    
    3767 3767
     
    
    3768 3768
           /* add it to our list of charmaps */
    
    3769
    -      if ( FT_RENEW_ARRAY( face->charmaps,
    
    3770
    -                           face->num_charmaps,
    
    3771
    -                           face->num_charmaps + 1 ) )
    
    3769
    +      if ( FT_QRENEW_ARRAY( face->charmaps,
    
    3770
    +                            face->num_charmaps,
    
    3771
    +                            face->num_charmaps + 1 ) )
    
    3772 3772
             goto Fail;
    
    3773 3773
     
    
    3774 3774
           face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap;
    
    ... ... @@ -4459,10 +4459,10 @@
    4459 4459
         FT_Library   library = module->library;
    
    4460 4460
         FT_Memory    memory  = library->memory;
    
    4461 4461
         FT_Error     error;
    
    4462
    -    FT_ListNode  node    = NULL;
    
    4462
    +    FT_ListNode  node;
    
    4463 4463
     
    
    4464 4464
     
    
    4465
    -    if ( FT_NEW( node ) )
    
    4465
    +    if ( FT_QNEW( node ) )
    
    4466 4466
           goto Exit;
    
    4467 4467
     
    
    4468 4468
         {
    

  • src/cache/ftcmru.c
    ... ... @@ -237,7 +237,7 @@
    237 237
                        FTC_MruNode  *anode )
    
    238 238
       {
    
    239 239
         FT_Error     error;
    
    240
    -    FTC_MruNode  node   = NULL;
    
    240
    +    FTC_MruNode  node;
    
    241 241
         FT_Memory    memory = list->memory;
    
    242 242
     
    
    243 243
     
    

  • src/psaux/psstack.c
    ... ... @@ -54,9 +54,8 @@
    54 54
                       FT_Error*  e,
    
    55 55
                       FT_UInt    stackSize )
    
    56 56
       {
    
    57
    -    FT_Error  error = FT_Err_Ok;     /* for FT_NEW */
    
    58
    -
    
    59
    -    CF2_Stack  stack = NULL;
    
    57
    +    FT_Error   error;     /* for FT_QNEW */
    
    58
    +    CF2_Stack  stack;
    
    60 59
     
    
    61 60
     
    
    62 61
         if ( FT_QNEW( stack ) )
    

  • src/truetype/ttgload.c
    ... ... @@ -1920,7 +1920,7 @@
    1920 1920
     
    
    1921 1921
           else
    
    1922 1922
           {
    
    1923
    -        if ( FT_NEW( node ) )
    
    1923
    +        if ( FT_QNEW( node ) )
    
    1924 1924
               goto Exit;
    
    1925 1925
             node->data = FT_UINT_TO_POINTER( glyph_index );
    
    1926 1926
             FT_List_Add( &loader->composites, node );
    

  • src/truetype/ttinterp.c
    ... ... @@ -275,64 +275,6 @@
    275 275
       }
    
    276 276
     
    
    277 277
     
    
    278
    -  /**************************************************************************
    
    279
    -   *
    
    280
    -   * @Function:
    
    281
    -   *   Init_Context
    
    282
    -   *
    
    283
    -   * @Description:
    
    284
    -   *   Initializes a context object.
    
    285
    -   *
    
    286
    -   * @Input:
    
    287
    -   *   memory ::
    
    288
    -   *     A handle to the parent memory object.
    
    289
    -   *
    
    290
    -   * @InOut:
    
    291
    -   *   exec ::
    
    292
    -   *     A handle to the target execution context.
    
    293
    -   *
    
    294
    -   * @Return:
    
    295
    -   *   FreeType error code.  0 means success.
    
    296
    -   */
    
    297
    -  static FT_Error
    
    298
    -  Init_Context( TT_ExecContext  exec,
    
    299
    -                FT_Memory       memory )
    
    300
    -  {
    
    301
    -    FT_Error  error;
    
    302
    -
    
    303
    -
    
    304
    -    FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec ));
    
    305
    -
    
    306
    -    exec->memory   = memory;
    
    307
    -    exec->callSize = 32;
    
    308
    -
    
    309
    -    if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
    
    310
    -      goto Fail_Memory;
    
    311
    -
    
    312
    -    /* all values in the context are set to 0 already, but this is */
    
    313
    -    /* here as a remainder                                         */
    
    314
    -    exec->maxPoints   = 0;
    
    315
    -    exec->maxContours = 0;
    
    316
    -
    
    317
    -    exec->stackSize = 0;
    
    318
    -    exec->glyphSize = 0;
    
    319
    -
    
    320
    -    exec->stack    = NULL;
    
    321
    -    exec->glyphIns = NULL;
    
    322
    -
    
    323
    -    exec->face = NULL;
    
    324
    -    exec->size = NULL;
    
    325
    -
    
    326
    -    return FT_Err_Ok;
    
    327
    -
    
    328
    -  Fail_Memory:
    
    329
    -    FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec ));
    
    330
    -    TT_Done_Context( exec );
    
    331
    -
    
    332
    -    return error;
    
    333
    - }
    
    334
    -
    
    335
    -
    
    336 278
       /**************************************************************************
    
    337 279
        *
    
    338 280
        * @Function:
    
    ... ... @@ -375,7 +317,7 @@
    375 317
     
    
    376 318
         if ( *size < new_max )
    
    377 319
         {
    
    378
    -      if ( FT_REALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
    
    320
    +      if ( FT_QREALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
    
    379 321
             return error;
    
    380 322
           *size = new_max;
    
    381 323
         }
    
    ... ... @@ -617,19 +559,19 @@
    617 559
     
    
    618 560
         memory = driver->root.root.memory;
    
    619 561
     
    
    620
    -    /* allocate object */
    
    562
    +    /* allocate object and zero everything inside */
    
    621 563
         if ( FT_NEW( exec ) )
    
    622 564
           goto Fail;
    
    623 565
     
    
    624
    -    /* initialize it; in case of error this deallocates `exec' too */
    
    625
    -    error = Init_Context( exec, memory );
    
    626
    -    if ( error )
    
    627
    -      goto Fail;
    
    566
    +    /* create callStack here, other allocations delayed */
    
    567
    +    exec->memory   = memory;
    
    568
    +    exec->callSize = 32;
    
    628 569
     
    
    629
    -    return exec;
    
    570
    +    if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
    
    571
    +      FT_FREE( exec );
    
    630 572
     
    
    631 573
       Fail:
    
    632
    -    return NULL;
    
    574
    +    return exec;
    
    633 575
       }
    
    634 576
     
    
    635 577
     
    

  • src/truetype/ttpload.c
    ... ... @@ -571,7 +571,7 @@
    571 571
           goto Fail;
    
    572 572
         }
    
    573 573
     
    
    574
    -    if ( FT_NEW_ARRAY( face->hdmx_record_sizes, num_records ) )
    
    574
    +    if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) )
    
    575 575
           goto Fail;
    
    576 576
     
    
    577 577
         for ( nn = 0; nn < num_records; nn++ )
    


  • reply via email to

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